【发布时间】:2017-09-12 01:56:48
【问题描述】:
我有 microsoft windows server iis 7,我已经在上面安装了 apache2 x-sendfile 插件安装在 apache 上,但是当我通过以下代码对其进行测试时
if (in_array('mod_xsendfile', $modules)) {
// If mod_xsendfile is loaded, use X-Sendfile to deliver.. (optional: I have this as failover to use PHP readfile() if mod_xsendfile is unavailable)
header ('X-Sendfile: ' . $pathToFile);
header ('Content-Type: ' . $documentMIME);
header ('Content-Disposition: attachment; filename="' . $actualFilename . '"');
exit;}
什么都没发生!!! 有什么问题?
【问题讨论】:
-
$modules是如何填充的?可以通过phpinfo()查看mod_xsendfile是否加载; - 如果存在,它会列在“加载的模块”下。您是否在 httpd.conf 中启用了 x-sendfile?LoadModule xsendfile_module modules/mod_xsendfile.so和<IfModule xsendfile_module> XSendFile on </IfModule>都需要在场吗? -
谢谢,问题解决了!!! xD
标签: php apache2 x-sendfile