例1,file读取csv文件
例2,fgetcsv读取一个csv文件
<?php
$fh = fopen("./demoCSV.csv", "r");
while (list($name, $email, $phone) = fgetcsv($fh, 1024, ",")) {
echo "<p>$name ($email) Tel. $phone</p>";
} //edit by www.jb200.com
?>
<!--
A,a@example.com,11111
B,b@example.com,22222
-->
例3,fopen读取一个csv文件
<?php
$file = "./demoCSV.csv";
$fh = fopen($file, "rt");
$userdata = fread($fh, filesize($file));
fclose($fh);
echo $userdata;
?>