这段代码使用“保存文件”或“打开文件”在图像查看器中显示图像.实际上,我想问的只是打开与用户我做什么


This code shows the image in a image viewer with save file or openwith. Actually i want to ask only open with for users what i do?

<?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将简单地下载文件到磁盘,根本没有任何提示。其他浏览器也会问。你无法控制它