亚洲乱码中文字幕综合,中国熟女仑乱hd,亚洲精品乱拍国产一区二区三区,一本大道卡一卡二卡三乱码全集资源,又粗又黄又硬又爽的免费视频

解析PHP實(shí)現(xiàn)下載文件的兩種方法

 更新時(shí)間:2013年07月05日 08:49:35   作者:  
本篇文章是對使用PHP實(shí)現(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();

相關(guān)文章

最新評論