/** * 下载 * @param [type] $url [description] * @param string $filename [description] * @return [type] [description] */ private function downLoad($url,$pnum){ if ($url == "") return false; ob_start(); //打开浏览器的缓冲区 readfile($url); //读入缓冲区 $file = ob_get_contents(); //获取缓冲区的内容复制给变量$file ob_end_clean(); //关闭并清空缓冲 if(!$file) return false; //下载文件需要用到的头 Header("Content-type: Content-type: image/jpeg"); header("Content-Disposition:attachment;filename=".$pnum.'_'.date('Ymd').'_'.md5(time()).".docx"); echo $file;
die(); }