php分析tsv文件

tsv跟csv很像,不過csv是以,分格數據,tsv是以tab分格。
php分析tsv數據:

$path = "D:\\test.tsv";
if(file_exists($path))
{
$fp = fopen($path,'r');
while (!feof($fp)) {
$str = fgets($fp);
$pieces = explode("\t", $str);
var_dump($pieces);
}
}
else
{
echo "file not exists.";
}
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章