【发布时间】:2013-08-05 19:41:54
【问题描述】:
我正在尝试检查服务器上是否存在图像文件。我正在获取其他服务器的图像路径。
请检查下面我尝试过的代码,
$urlCheck = getimagesize($resultUF['destination']);
if (!is_array($urlCheck)) {
$resultUF['destination'] = NULL;
}
但是,它显示在警告下方
Warning: getimagesize(http://www.example.com/example.jpg) [function.getimagesize]: failed to open stream: HTTP request failed! HTTP/1.1 404 Not Found in
有什么办法吗?
谢谢
【问题讨论】:
-
你需要提供像“images/example.jpg”这样的绝对路径
-
@MakC 任何答案有帮助吗?
-
@sankalpMishra 是的,我尝试了以下答案,但由于 allow_url_fopen 它在服务器上显示警告,所以我尝试使用 CURL,它对我有用。
-
@PravinS 我不能使用绝对路径,因为我的图像文件在另一台服务器上,而我的代码在另一台服务器上
-
@MakC 使用 get_headers() 函数,它会返回你的长度,http响应等等
标签: php