将csv转换为字符串的最佳方法是什么?

时间:2012-08-26 09:38:36

标签: php string csv

将csv转换为字符串的最佳方法是什么?

有csv file.txt用file_get_contents()读取变量,如1,2,3,4,5,必须变成12345.I可以将它爆炸成数组,然后组合它但也许还有更多有效的方法吗?

1 个答案:

答案 0 :(得分:0)

如果您只需要1,2,3,4,5中的12345,请执行以下操作:

$string = str_replace(",","", file_get_contents("file.txt"));