您好,欢迎访问一九零五行业门户网

php 点击链接图片下载程序代码

这篇文章主要介绍了php 点击链接图片下载程序代码 ,有着一定的参考价值,现在分享给大家,有需要的朋友可以参考一下
页面用<a href>click</a>跳转进来,就可以直接下载文件了

$imagename = $_get['imagename']; $imageurl = $_get['imageurl']; $localhostpath = str_replace("\\","/",dirname(__file__)); //这里要引用绝对路径 $imageurl = $localhostpath."/".$imageurl."/".$imagename; //合并成一个完整的路径 $imageurl = iconv('utf-8', 'gbk', $imageurl); //这里可以防止中文名文件乱码,我的机器环境是utf-8 header('content-type: application/octet-stream'); header('content-disposition: attachment; filename='.$filename); header("content-length:". filesize($imagename)); ob_clean(); flush(); readfile($imageurl);
以上就是php 点击链接图片下载程序代码 的详细内容。
其它类似信息

推荐信息