Advertisement
Guest User

Untitled

a guest
Jan 19th, 2017
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.56 KB | None | 0 0
  1. public function importCsv($file)
  2. {
  3. if (($handle = fopen($file, "r")) !== FALSE) {
  4. $i = 0;
  5. $infos = [];
  6. while (($data = fgetcsv($handle, 4000, ";")) !== FALSE) {
  7. if ($i > 0 ){
  8. $num = count($data);
  9. for ($c=0; $c < $num; $c++) {
  10. $infos[$i-1][$c] = $data[$c];
  11. }
  12. }
  13. $i++;
  14. }
  15. $this->setVar( 'infos', $infos);
  16. fclose($handle);
  17. return $infos;
  18. }
  19. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement