<?php
$img=$_GET['im'];
$im="http://localhost/proj1/images/PICS/$img";
$contents= file_get_contents("$im");
$output_file = 'image.jpg';
header("Content-Disposition: attachment; filename=" . $output_file);
header("Content-Type: image/jpg");
//header('Content-Length: ' . filesize($contents));
echo $contents;
exit();
?>
你没有这个选择。如果指定Content-Disposition: attachment
,浏览器将下载文件。浏览器如何准确地做到这一点取决于。Safari或Chrome将简单地下载文件到磁盘,根本没有任何提示。其他浏览器也会问。你无法控制它