国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 語言 > PHP > 正文

php隱藏文件下載路徑實例

2024-09-04 11:48:13
字體:
來源:轉載
供稿:網友

如果我們需要隱藏下載文件路徑我們只要直接輸入就可以了,而不需要跳轉路徑,下面我們來看一個實例,希望對各位同學會有所幫助,代碼如下:

  1. <?php  
  2.    
  3. //設置頭信息,強制下載文件  
  4. function download_send_headers($filename) {  
  5.     // disable caching  
  6.     $now = gmdate("D, d M Y H:i:s");  
  7.     header("Expires: Tue, 03 Jul 2001 06:00:00 GMT");  
  8.     header("Cache-Control: max-age=0, no-cache, must-revalidate, proxy-revalidate");  
  9.     header("Last-Modified: {$now} GMT");  
  10.    
  11.     // force download  
  12.     header("Content-Type: application/force-download");  
  13.     header("Content-Type: application/octet-stream");  
  14.     header("Content-Type: application/download");  
  15.    
  16.     // disposition / encoding on response body  
  17.     header("Content-Disposition: attachment;filename={$filename}");  
  18.     header("Content-Transfer-Encoding: binary");  
  19. }  
  20. $file_name='download.csv';  
  21. $file_path=dirname ( __FILE__ ).'/file/'.$file_name;  
  22. download_send_headers($file_name);  
  23. readfile($file_path);  
  24. exit;  
  25. ?> 

發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 东乡| 金秀| 靖远县| 和田市| 庄浪县| 探索| 阳山县| 新蔡县| 威海市| 丰原市| 蓝田县| 仪征市| 修水县| 从江县| 米林县| 洛浦县| 上栗县| 宜兰市| 讷河市| 墨江| 金川县| 芮城县| 肥城市| 佛学| 察雅县| 襄城县| 客服| 安康市| 麻城市| 新闻| 南昌市| 云安县| 罗平县| 黄冈市| 金川县| 石楼县| 织金县| 宁武县| 大连市| 蒙阴县| 铜鼓县|