Guest User

Untitled

a guest
Nov 20th, 2018
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.28 KB | None | 0 0
  1. <?php
  2. $ret = [];
  3. // echo __DIR__;
  4. $fp = fopen('./users.csv', "r");
  5. if(!$fp) {
  6. echo 'file not found';
  7. return;
  8. }else{
  9. $columns = array('userid', 'nickname', 'count');
  10. while($row=fgetcsv($fp)) {
  11. $ret[] = array_combine($columns, $row);
  12. }
  13. }
  14. echo json_encode($ret);
  15.  
  16. return $ret;
  17. ?>
Add Comment
Please, Sign In to add comment