图像下载无效。它直接读取而不是下载。
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;
}
答案 0 :(得分:0)
尝试此标题格式
header("Content-type: application/octet-stream");
header("Content-Length: " . filesize($filename));
header("Content-Disposition: attachment; filename=$filename");
header('Content-Transfer-Encoding: binary');
header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
fpassthru($fp);