【发布时间】:2012-10-25 11:46:43
【问题描述】:
这是我的代码,
<?php
$file_name = "coupon.png";
$file_path = $_GET['path'];
$file_size = filesize($file_path);
header('Pragma: public');
header('Expires: 0');
header('Last-Modified: ' . gmdate('D, d M Y H:i ') . ' GMT');
header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
header('Cache-Control: private', false);
header('Content-Type: application/octet-stream');
header('Content-Length: ' . $file_size);
header('Content-Disposition: attachment; filename="' . $file_name . '";');
header('Content-Transfer-Encoding: binary');
readfile($file_path);
?>
附: $_GET['path'] 图片路径 url
在PC的浏览器中,那些编码可以流畅运行。 但是,如果用户使用他们的移动浏览器下载,它将显示一个新的网页标签。
用户有什么方法可以自动下载图片并存储到他们的手机图库中?
【问题讨论】:
标签: php mobile safari mobile-website