我收到以下错误:
“注意:fgetcsv()[function.fgetcsv]:分隔符必须是”在我的浏览器中的单个字符
我的PHP代码如下 - 有人可以重新安排它吗?
$fh = fopen('notes.txt', 'r') or die('Unable to open notes.txt');
while(($line = fgetcsv($fh, 0, '||')) !== FALSE)
if ($line[0] == $name) {
echo <<<EOL
My color is $line[2]
EOL;
break; // if there's only ever one '5678' line in the, get out now.
}
fclose($fh);
答案 0 :(得分:1)
来自fgetcsv文档,您的分隔符长度只能是一个字符。虽然在询问有关能够查看数据(或数据样本)的文件的问题时非常有价值,但未来参考
答案 1 :(得分:0)
简单来说,你使用两个字符“||”当你只能用逗号“,”时。 Read the documentation.