我如何简单地写出一个包含真实选项卡的文件? tab 表示真正的 tab,它不是空格。 tab怎么写或者真正的tab是什么字符?
例如这里:
$chunk = "a,b,c";
file_put_contents("chunk.csv",$chunk);
我应该使用什么字符来获取 tabs 而不是 逗号 (,) 那里?
在输出文件中,分隔的单词之间应该有真正的 tabs。
键时,我们会得到一个真正的宽空间。Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号
Use
\tand enclose the string with double-quotes:The tab character is
\t. Notice the use of"instead of'.PHP 字符串 - 双精度引用
另外,让我推荐 fputcsv() 函数,它是用于写入 CSV 文件。