国产探花免费观看_亚洲丰满少妇自慰呻吟_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. ?> 

發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 常宁市| 江油市| 七台河市| 兴和县| 太康县| 民权县| 濮阳市| 鹿泉市| 邮箱| 鄂伦春自治旗| 安平县| 巴彦淖尔市| 陆良县| 东安县| 仁化县| 日喀则市| 东至县| 新乡县| 东源县| 德清县| 应用必备| 吴堡县| 左权县| 农安县| 田东县| 东乌| 乡宁县| 南雄市| 宁津县| 青田县| 娄底市| 九江县| 杭锦旗| 瑞昌市| 广东省| 中宁县| 海阳市| 赤壁市| 交口县| 天镇县| 星子县|