您好,欢迎访问一九零五行业门户网

怎么实现图片下载

如何实现图片下载
有这样一个地址 打开这个地址是图片  http://qr.topscan.com/api.php?text=x  
想实现这样的一个功能
1.html
点击下载图片
1.php
$filename= http://qr.topscan.com/api.php?text=x  
     header('content-type: image/jpeg'); 
     header(content-disposition: attachment; filename='$filename');
这样没办法下载图片,请教一下大家应该怎么写
------解决思路----------------------
不明白你们在干什么?
点击下载图片
如果是为了显示图片,则 1.php 为echo file_get_contents('http://qr.topscan.com/api.php?text=x');
如果是为了下载图片,则 1.php 为$s = file_get_contents('http://qr.topscan.com/api.php?text=x');
header(content-type: application/force-download);
header(accept-ranges:bytes);
header(accept-length: . strlen($s));
header(content-disposition: attachment; filename=x.png);
echo $s;

file_exists 函数只用于检查本地文件是否存在
其它类似信息

推荐信息