PHP下载图片
PHP 2009/12/3 9:52:26 点击:不统计
如何用php下载图片并能自动命名那个,下面是详细的代码以及解释
<?
$imgURL="http://www.forasp.cn/images/logo2.gif";//这里是图片地址
$temparray = explode("/",$imgURL);//通过数组分离图片名称以及后缀
$tempimgname = $temparray[count($temparray)-1];//默认为命forasp.cn名的图片名称
header('Content-type: image/jpeg');
//header("Content-Disposition: attachment; filename=保存为的图片名称.gif");
header("Content-Disposition: attachment; filename=".$tempimgname."");
//打开保存图片
readfile("$imgURL");
?>
参考php手册,www.forasp.cn编辑
·上一篇:smarty判断字符串内含有字符 >> ·下一篇:php遍历积分 >>