PHP 如何向header()函数生成的文件中写入内容?

$str = '1564804630';
$filename = 'text.txt';
header("Content-type: text/plain");
header("Accept-Ranges: bytes");
header("Content-Disposition: attachment; filename=".$filename);
...
下面该怎么把字符串加入到文件中呢?

向文本文件写入内容的例子语句:
file_put_contents('text.txt', 'hello, world');
温馨提示:内容为网友见解,仅供参考
无其他回答
相似回答