PHP读取流文件

            $filepath = 'http://www.vip.com/down';
            $fp = fopen($filepath,"r");
            Header("Content-type: application/octet-stream");
            Header("Accept-Ranges: bytes");
            Header("Content-Disposition: attachment; filename=xxx.pdf");
            $buffer = 1024;
            while (!feof($fp)) {
            $file_con = fread($fp,$buffer);
                echo $file_con;
            }
            fclose($fp);    

 

posted @ 2015-08-02 12:39  北京流浪儿  阅读(1507)  评论(0编辑  收藏  举报