效果有个保存按钮就是保存图片。。。 就是相当于另存为的效果怎么搞 那个框怎么弹 那个弹出来的框跟php没多大关系,更多的是前端方面的,js或flex或其他 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 好方法直接给个链接就好了 但事先要把图片放到服务器了。。 服务器路径怎么写的 我只会写本地的路径 比方说放到 yonghu文件夹里。。<?php function get_file($url,$folder,$pic_name){ set_time_limit(24*60*60); //限制最大的执行时间 $destination_folder=$folder?$folder.'/':''; //文件下载保存目录 $newfname=$destination_folder.$pic_name;//文件PATH $file=fopen($url,'rb'); if($file){ $newf=fopen($newfname,'wb'); if($newf){ while(!feof($file)){ fwrite($newf,fread($file,1024*8),1024*8); } } if($file){ fclose($file); } if($newf){ fclose($newf); } } } ?> get_file($_POST[location],"D:\jieri","baidu.jpg");这个房本地的 放服务器怎么放? 我知道了 比方说http://csdnimg.cn/www/images/csdn_logo_blue.gif 这个图片 PHP怎么写 以下载的形式? 写成a href 也不行哈 打开也是一张图片哈。。 怎么不会搜索呢?http://www.google.com.hk/#newwindow=1&q=php+%E4%B8%8B%E8%BD%BD%E6%96%87%E4%BB%B6&safe=strict 那么多条搜索结果,copy下来试试不就知道了。 <?php//文件下载//readfile$filename="D:\jieri\baidu.jpg";$fileinfo = pathinfo($filename);header('Content-type: application/x-'.$fileinfo['extension']);header('Content-Disposition: attachment; filename='.$fileinfo['basename']);header('Content-Length: '.filesize($filename));readfile($thefile);exit();?>这个代码确实是保存 但是保存下载的图片压根打不开哎 路径又没写错 readfile($filename); 路径分隔符用/ $filename="D:/jieri/baidu.jpg"; 还是不行 打不开 $filename="D:/jieri/baidu.jpg"; 还是不行 打不开 我用网络地址也打不开。。这个代码肯定有问题哈 <?php//文件下载//readfile$filename="http://csdnimg.cn/www/images/csdn_logo_blue.gif";$fileinfo = pathinfo($filename);header('Content-type: application/x-'.$fileinfo['extension']);header('Content-Disposition: attachment; filename='.$fileinfo['basename']);header('Content-Length: '.filesize($filename));readfile($thefile);exit();?>打开 header("Content-type:text/html;charset=utf-8"); if($file_name = @$_GET['file_name']){ down($file_name);}function down($file_name){ $file_name=iconv("utf-8","gb2312",$file_name);//中文上传 $file_sub_path=$_SERVER['DOCUMENT_ROOT']."/file/"; $file_path=$file_sub_path.$file_name; if(!file_exists($file_path)){ echo "没有该文件文件"; return ; } $fp=fopen($file_path,"r"); $file_size=filesize($file_path); //下载文件需要用到的头 Header("Content-type: application/octet-stream"); Header("Accept-Ranges: bytes"); Header("Accept-Length:".$file_size); Header("Content-Disposition: attachment; filename=".$file_name); $buffer=1024; $file_count=0; //向浏览器返回数据 while(!feof($fp) && $file_count<$file_size){ $file_con=fread($fp,$buffer); $file_count+=$buffer; echo $file_con; } fclose($fp);}?><input type="button" value="下载" onclick="location.href='dd.php?file_name=qq.png'"/> 我晕我只要写 已知http://www.cn.tesco.com/images2013/logo.jpg 图片 怎么下载<?php//文件下载//readfile$filename="http://csdnimg.cn/www/images/csdn_logo_blue.gif";$fileinfo = pathinfo($filename);header('Content-type: application/x-'.$fileinfo['extension']);header('Content-Disposition: attachment; filename='.$fileinfo['basename']);header('Content-Length: '.filesize($filename));readfile($thefile);exit();?>这个代码根本就不行 我晕我只要写 已知http://www.cn.tesco.com/images2013/logo.jpg 图片 怎么下载<?php//文件下载//readfile$filename="http://csdnimg.cn/www/images/csdn_logo_blue.gif";$fileinfo = pathinfo($filename);header('Content-type: application/x-'.$fileinfo['extension']);header('Content-Disposition: attachment; filename='.$fileinfo['basename']);header('Content-Length: '.filesize($filename));readfile($thefile);exit();?>这个代码根本就不行http://www.oschina.net/code/snippet_272777_21247 刚刚发现的代码,不过没有另存为框<?phpcopy("http://www.cn.tesco.com/images2013/logo.jpg", "./dd.jpg");$size = round((filesize('./dd.jpg')/1000000), 3); ?> 亲,我又来了又带来一个方法...<?phpheader("content-type:text/html;charset=utf-8");$url = @$_GET['url'];$file_name = 'test.jpg';if($url){ $file = @fopen($url,"r"); header("content-type: application/octet-stream"); header("content-disposition: attachment; filename=".$file_name); while (!feof ($file)) {//测试文件指针是否到了文件结束的位置 echo fread($file,50000); } fclose ($file);}?><input type="button" value="保存" onclick="location.href='cc.php?url=http://www.cn.tesco.com/images2013/logo.jpg'" />我怎么有种自娱自乐的感觉 求教个关于PHP图像输出的问题 php字符串截取 php中如何获取404页面的之前的那个url mysql的id自动编号,如何复原到原始? PHP上传问题 字符串中屏[]问题,在线等 php个位数前面自动加零 求一关联,无论左关联为空值,或者右关联为空值,都能显示出来。 大家熟悉一个类会要多久的时间? 求一个防刷新的php文本计数器,百分相送。在线等。 求大神指点php正则面试题 当PHP页面没加载完成时,用户点击刷新了,怎么结束上次没加载完成的页面而重新加载?
好方法直接给个链接就好了 但事先要把图片放到服务器了。。 服务器路径怎么写的 我只会写本地的路径 比方说放到 yonghu文件夹里。。
<?php function get_file($url,$folder,$pic_name){
set_time_limit(24*60*60); //限制最大的执行时间
$destination_folder=$folder?$folder.'/':''; //文件下载保存目录
$newfname=$destination_folder.$pic_name;//文件PATH
$file=fopen($url,'rb');
if($file){
$newf=fopen($newfname,'wb');
if($newf){
while(!feof($file)){
fwrite($newf,fread($file,1024*8),1024*8);
}
}
if($file){
fclose($file);
}
if($newf){
fclose($newf);
}
}
}
?> get_file($_POST[location],"D:\jieri","baidu.jpg");这个房本地的 放服务器怎么放?
http://www.google.com.hk/#newwindow=1&q=php+%E4%B8%8B%E8%BD%BD%E6%96%87%E4%BB%B6&safe=strict
//文件下载
//readfile
$filename="D:\jieri\baidu.jpg";
$fileinfo = pathinfo($filename);
header('Content-type: application/x-'.$fileinfo['extension']);
header('Content-Disposition: attachment; filename='.$fileinfo['basename']);
header('Content-Length: '.filesize($filename));
readfile($thefile);
exit();
?>
这个代码确实是保存 但是保存下载的图片压根打不开哎 路径又没写错
$filename="D:/jieri/baidu.jpg"; 还是不行 打不开
$filename="D:/jieri/baidu.jpg"; 还是不行 打不开 我用网络地址也打不开。。这个代码肯定有问题哈
//文件下载
//readfile
$filename="http://csdnimg.cn/www/images/csdn_logo_blue.gif";
$fileinfo = pathinfo($filename);
header('Content-type: application/x-'.$fileinfo['extension']);
header('Content-Disposition: attachment; filename='.$fileinfo['basename']);
header('Content-Length: '.filesize($filename));
readfile($thefile);
exit();
?>打开
if($file_name = @$_GET['file_name']){
down($file_name);
}
function down($file_name){
$file_name=iconv("utf-8","gb2312",$file_name);//中文上传
$file_sub_path=$_SERVER['DOCUMENT_ROOT']."/file/";
$file_path=$file_sub_path.$file_name;
if(!file_exists($file_path)){
echo "没有该文件文件";
return ;
}
$fp=fopen($file_path,"r");
$file_size=filesize($file_path);
//下载文件需要用到的头
Header("Content-type: application/octet-stream");
Header("Accept-Ranges: bytes");
Header("Accept-Length:".$file_size);
Header("Content-Disposition: attachment; filename=".$file_name);
$buffer=1024;
$file_count=0;
//向浏览器返回数据
while(!feof($fp) && $file_count<$file_size){
$file_con=fread($fp,$buffer);
$file_count+=$buffer;
echo $file_con;
}
fclose($fp);
}
?>
<input type="button" value="下载" onclick="location.href='dd.php?file_name=qq.png'"/>
//文件下载
//readfile
$filename="http://csdnimg.cn/www/images/csdn_logo_blue.gif";
$fileinfo = pathinfo($filename);
header('Content-type: application/x-'.$fileinfo['extension']);
header('Content-Disposition: attachment; filename='.$fileinfo['basename']);
header('Content-Length: '.filesize($filename));
readfile($thefile);
exit();
?>这个代码根本就不行
//文件下载
//readfile
$filename="http://csdnimg.cn/www/images/csdn_logo_blue.gif";
$fileinfo = pathinfo($filename);
header('Content-type: application/x-'.$fileinfo['extension']);
header('Content-Disposition: attachment; filename='.$fileinfo['basename']);
header('Content-Length: '.filesize($filename));
readfile($thefile);
exit();
?>这个代码根本就不行http://www.oschina.net/code/snippet_272777_21247
copy("http://www.cn.tesco.com/images2013/logo.jpg", "./dd.jpg");
$size = round((filesize('./dd.jpg')/1000000), 3);
?>
又带来一个方法...
<?php
header("content-type:text/html;charset=utf-8");
$url = @$_GET['url'];
$file_name = 'test.jpg';
if($url){
$file = @fopen($url,"r");
header("content-type: application/octet-stream");
header("content-disposition: attachment; filename=".$file_name);
while (!feof ($file)) {//测试文件指针是否到了文件结束的位置
echo fread($file,50000);
}
fclose ($file);
}
?>
<input type="button" value="保存" onclick="location.href='cc.php?url=http://www.cn.tesco.com/images2013/logo.jpg'" />
我怎么有种自娱自乐的感觉