Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
将 csv 转换为字符串的最佳方法是什么?
有 csv file.txt 用 file_get_contents() 读入变量,如 1,2,3,4,5 并且必须变成 12345。我可以将它分解成数组然后组合它,但也许有更有效的方法来做吗?
如果您只需要 1,2,3,4,5 中的 12345,请执行以下操作:
$string = str_replace(",","", file_get_contents("file.txt"));