我想从服务器下载文本文件到客户机,代码正在工作,但是在我下载文本文件之后,它在顶部显示了一个额外的空行。
如何删除该行,或者如何将文本文件的原始格式输入客户端计算机?
这是我的代码:
$code = $_POST["Code"];
$File = "my$code.txt";
if (file_exists($File))
{
header("Content-Type:text/plain");
header ("Content-Disposition: attachment; filename=$File");
header("Content-Length:" . filesize("$File"));
$fp = fopen("$File", "r");
fpassthru($fp);
}发布于 2014-04-09 07:33:07
检查所有标签是否已关闭(打开和关闭)。从php页面中删除所有空行。
发布于 2014-04-09 07:14:56
确保在打开的<?php标记前面没有。
https://stackoverflow.com/questions/22955276
复制相似问题