PHP读取流文件

 1 <?php
 2 $filepath = 'http://www.vip.com/down';
 3 $fp = fopen($filepath,"r");
 4 Header("Content-type: application/octet-stream");
 5 Header("Accept-Ranges: bytes");
 6 Header("Content-Disposition: attachment; filename=xxx.pdf");
 7 $buffer = 1024;
 8 while (!feof($fp)) {
 9 $file_con = fread($fp,$buffer);
10     echo $file_con;
11 }
12 fclose($fp);

 

posted @ 2015-04-19 21:13  北京流浪儿  阅读(417)  评论(0编辑  收藏  举报