php 读取 CSV 文件的PHP代码
读取 CSV 文件的PHP代码 [代码片段(8行)] 用法: [代码片段(5行)]
function readCSV($csvFile){
$file_handle = fopen($csvFile, 'r');
while (!feof($file_handle) ) {
$line_of_text[] = fgetcsv($file_handle, 1024);
}
fclose($file_handle);
return $line_of_text;
}
用法:
<?php $csvFile = "test.csv"; $csv = readCSV($csvFile); $a = csv[0][0]; // This will get value of Column 1 & Row 1 ?>
精彩图集
精彩文章






