尝试这个:
function grab_image($url,$saveto){ $ch = curl_init ($url); curl_setopt($ch, CURLOPT_HEADER, 0); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_BINARYTRANSFER,1); $raw=curl_exec($ch); curl_close ($ch); if(file_exists($saveto)){ unlink($saveto); } $fp = fopen($saveto,'x'); fwrite($fp, $raw); fclose($fp);}
并确保在php.ini中启用allow_url_fopen
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)