当我在我的应用程序中使用函数getimagesize
或imagecreatefromjpeg
链接时,它会向我发送一个错误:
getimagesize():php_network_getaddresses:getaddrinfo失败:名称或服务未知
这是我的代码:
// tidy up by removing temporary image
unlink($tempname);
return $retvars;
}
/**
* Extract info from a JPEG file without using the GD library.
* @param $file (string) image file to parse
* @return array structure containing the image data
* @public static
*/
public static function _parsejpeg($file) {
$a = getimagesize($file);
if (empty($a)) {
//Missing or incorrect image file
return false;
}
if ($a[2] != 2) {
// Not a JPEG file
return false;
}
// bits per pixel
$bpc = isset($a['bits']) ? intval($a['bits']) : 8;
// number of image channels
if (!isset($a['channels'])) {
正是当我在地址栏中复制图像链接时,它会出现并且存在。我的 PHP 版本是 5.3.3。