当前位置: 动力学知识库 > 问答 > 编程问答 >

file_exsists not working php

问题描述:

I have this problem:

$id is id for each user

$img = 'http://www.somesite.com/pictures/';

$no_img = 'http://www.somesite.com/pictures/default.jpg';

$slika_provera = "{$img}{$id[$i]}/t_1.jpg";

if (file_exists($slika_provera)){

$slika = $slika_provera;

} else {

$slika = $no_img;

}

And this loop always set $slika = $no_img no matter if the file exists or not. What am I doing wrong?

网友答案:

The function file_exists() does not work with URL's.

Have a look at the manual for file_exists() for methods to do equivalent for URL's: http://php.net/manual/en/function.file-exists.php in particular I use this approach: http://www.php.net/manual/en/function.file-exists.php#76420

分享给朋友:
您可能感兴趣的文章:
随机阅读: