a链接点击下载图片到本地(php)


$url="http://pan.baidu.com/share/qrcode?w=150&h=150&url=http://gandao.my".U('Question/index',array('id'=>$id));   //图片路径
$file_name = time().'.png';    //保存的图片名称
header('Content-Description: File Transfer');
header('Content-Type: application/octet-stream');
header('Content-Disposition: attachment; filename='.$file_name);  
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($url));
ob_clean();
flush();
readfile($url);
exit;


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM