$pic=$matche_pic[1][0];//远程文件路径
$data = file_get_contents($pic); // 读文件内容
$filetime = time(); //得到时间戳
$filepath = $_SERVER['DOCUMENT_ROOT']."public/".date("Ym",$filetime)."/";//图片保存的路径目录
if(!is_dir($filepath)){
mkdir($filepath,0777, true);
http://www.gaodaima.com/50590.htmlphp实现图片远程下载(PHP100论坛)_php
}
$filename = date("YmdHis",$filetime).rand(100,999).'.'.substr($pic,-3,3); //生成文件名,
$fp = @fopen($filepath.$filename,"w"); //以写方式打开文件
@fwrite($fp,$data); //
fclose($fp);//完工,哈
欢迎大家阅读《php实现图片远程下载(PHP100论坛)_php》,跪求各位点评,若觉得好的话请收藏本文,by 搞代码