圖像下載不起作用。它直接讀取而不是下載。圖像下載不起作用。它直接讀取
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