我正在尝试使用 curl 从 php 下载图像,但是不是将图像保存到服务器,它只是将随机字符输出到 Web 浏览器屏幕,这是代码
$final['IMAGE'] = 'http://www.google.com/images/srpr/logo3w.png';
$imagename = trim(basename($final['IMAGE']));
$url = $final['IMAGE'];
$path = '/media/import/';
$path .= $imagename;
$fp = fopen($path, 'w');
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_FILE, $fp);
$data = curl_exec($ch);
curl_close($ch);
fclose($fp);