PHP如何开发导出内容为一个TXT文本文件?
二话不说,直接看代码。
<?php
Header( "Content-type: application/octet-stream ");
Header( "Accept-Ranges: bytes ");
header( "Content-Disposition: attachment; filename=test.txt ");
header( "Expires: 0 ");
header( "Cache-Control: must-revalidate, post-check=0, pre-check=0 ");
header( "Pragma: public ");
echo "测试/r/n";
echo "输入的内容为文本文件的内容。/r/n";
?>
好了,通过Header来调整。
本文由 创作,采用 知识共享署名4.0 国际许可协议进行许可
本站文章除注明转载/出处外,均为本站原创或翻译,转载前请务必署名
最后编辑时间为: May 13, 2021 at 01:46 am