PHP读取CSV到数组

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了PHP读取CSV到数组相关的知识,希望对你有一定的参考价值。

  1. function read_csv_file($file) {
  2. $file = fopen($file, 'r');
  3. $csv = array();
  4.  
  5. while (($line = fgetcsv($file)) !== FALSE) {
  6. $csv[] = $line;
  7. }
  8.  
  9. fclose($file);
  10. return $csv;
  11. }

以上是关于PHP读取CSV到数组的主要内容,如果未能解决你的问题,请参考以下文章