日韩天天综合网_野战两个奶头被亲到高潮_亚洲日韩欧美精品综合_av女人天堂污污污_视频一区**字幕无弹窗_国产亚洲欧美小视频_国内性爱精品在线免费视频_国产一级电影在线播放_日韩欧美内地福利_亚洲一二三不卡片区

解析PHP實現(xiàn)下載文件的兩種方法_PHP教程

編輯Tag賺U幣
教程Tag:暫無Tag,歡迎添加,賺取U幣!

推薦:PHP系統(tǒng)命令函數(shù)使用分析
本篇文章是對PHP中系統(tǒng)命令函數(shù)的使用進(jìn)行了詳細(xì)的分析介紹,需要的朋友參考下 復(fù)制代碼 代碼如下: function execute($cmd) { $res = ''; if ($cmd) { if(function_exists('system')) { @ob_start(); @system($cmd); $res = @ob_get_contents(); @ob_end_clean(); } els

本篇文章是對使用PHP實現(xiàn)下載文件的兩種方法進(jìn)行了詳細(xì)的分析介紹,需要的朋友參考下  

方法一:

復(fù)制代碼 代碼如下:
 header('Content-Description: File Transfer');
 header('Content-Type: application/octet-stream');
 header('Content-Disposition: attachment; filename='.basename($filepath));
 header('Content-Transfer-Encoding: binary');
 header('Expires: 0′);
 header('Cache-Control: must-revalidate, post-check=0, pre-check=0′);
 header('Pragma: public');
 header('Content-Length: ' . filesize($filepath));
 readfile($file_path);


方法二:

復(fù)制代碼 代碼如下:


 $fileinfo = pathinfo($filename);
 header('Content-type: application/x-'.$fileinfo['extension']);
 header('Content-Disposition: attachment; filename='.$fileinfo['basename']);
 header('Content-Length: '.filesize($filename));
 readfile($thefile);
 exit();

分享:WordPress禁止輸出錯誤信息設(shè)置方法
用網(wǎng)站安全檢測掃瞄博客,發(fā)現(xiàn)了一個漏洞,實際上就是直接訪問主題路徑的話,get_header()函數(shù)未生效(Call to undefined function get_header() ),而我的WordPress會輸出完整的錯誤信息,將敏感名稱的目錄結(jié)構(gòu)暴露了,雖然對正常訪問沒有影響,可是會給某些人可乘之

來源:模板無憂//所屬分類:PHP教程/更新時間:2013-07-06
相關(guān)PHP教程