图像下载不起作用。它直接读取而不是下载。图像下载不起作用。它直接读取
if($_REQUEST['image'] == true){
$URl = $post->guid;
echo $URl;
header("Content-Type: image/png");
header('Content-Description: File Transfer');
header("Cache-Control: no-cache, validated");
header('Content-Type: application/octet-stream');
header("Content-Disposition: attachment; filename=\"".basename($URl)."\"");
header('Content-Transfer-Encoding: binary');
var_dump(readfile($URl));
die;
}
[变量是大小写敏感的(http://php.net/manual/en/language.variables.basics.php)。将'$ URl'更改为'$ URL'(注意Ls?)。 – Josh 2012-02-11 06:18:11
我做了,但没有工作.... – ayyan 2012-02-11 06:36:25
什么是“不工作”? – zerkms 2012-02-11 06:45:14