file_exists() returns false even if file exist (remote URL)

前端 未结 6 1996
走了就别回头了
走了就别回头了 2020-12-03 07:54

My file_exists() returns false even if provided image to check https://www.google.pl/logos/2012/haring-12-hp.png exist. Why?

Below I am pre

6条回答
  •  忘掉有多难
    2020-12-03 08:38

        $filename = "http://im.rediff.com/money/2011/jan/19sld3.jpg";
    
        $file_headers = @get_headers($filename);
    
        if($file_headers[0] == 'HTTP/1.1 404 Not Found') {
        //return false; 
        echo "file not found";
        }else {
        //return true;  
        echo "file found";
    
        }
    

提交回复
热议问题