日期:2014-05-17 浏览次数:20639 次
$t= ".jpg"
$url= "http://....."
$content=@file_get_contents($url);
$path="/home/img/";
$filename=$path.$t;
$fp=fopen($filename,"w+");
if (file_exists($filename)){
if (@fwrite($fp,$content)) //content的内容写入文件指针fp处
{
@fclose($fp);
return $filename;
}
else
{
@fclose($fp);
return false;
}
}
//检测文件是否已经存在 if(file_exists($file)) echo "存在"; else echo "不存在";
------解决方案--------------------
$path="dirname(__FILE__)./home/img/";