我在 6 美分上有以下安装。
apache version :Apache 2.0
httpd-tools-2.2.15-28.el6.centos.x86_64
httpd-devel-2.2.15-28.el6.centos.x86_64
httpd-2.2.15-28.el6.centos.x86_64 .
在 httpd.conf 我添加了以下行:LoadModule xsendfile_module /usr/lib64/httpd/modules/mod_xsendfile.so
和 apache_get_modules(); 在加载的 mod 数组中显示 mod_xsendfile... 现在我有了 .htaccess 文件,其中包含
<Files files.php>
XSendFile on
</Files>
和 files.php 有
$path='fileliste.txt';
$documentMIME="text/plain";
$modules = apache_get_modules();
if (in_array("mod_xsendfile", $modules)) {
header ("X-Sendfile: ". $path);
header ("Content-Type: " . $documentMIME);
//header ('Content-Disposition: attachment; filename="textfile"');
}
每件事似乎都是正确的。但它仍然没有显示任何文件。