windows 7 , apache 2.2 安装xsendfile 模块 的方法

LoadModule xsendfile_module modules/mod_xsendfile.so


XSendFile On

XSendFilePath O:/phpcode/download    # windows平台,驱动器号要大写

<Directory "O:/PHPCODE/DOWNLOAD/">

  #XSendFileAllowAbove on  #这个在win平台上无效

  AllowOverride None


  Order allow,deny        

</Directory>



php 代码:

<?php

$file = 'O:/phpcode/download/1.zip';

if (!file_exists($file)) {

   die("File '$file' doesn't exist.ok");

}


header("Content-Type:application/octet-stream");

header("X-Sendfile: $file");

header('Content-Disposition:attachment;filename=211.zip');

?>


你可能感兴趣的:(apache,PHP,window,xsendfile)