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');

?>


發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章