由於某些原因,下面的這段PHP代碼不起作用,我無法弄清楚。PHP的file_exists()不適合我嗎?
很奇怪, file_exists似乎是沒有看到的圖像是存在的,我檢查,以確保良好的文件路徑被插入file_exists功能,它仍然是演戲
如果我改變file_exists來!file_exists它將返回存在不存在
define('SITE_PATH2', 'http://localhost/');
$noimg = SITE_PATH2. 'images/userphoto/noimagesmall.jpg';
$thumb_name = 'http://localhost/images/userphoto/1/2/2/59874a886a0356abc1_thumb9.jpg';
if (file_exists($thumb_name)) {
$img_name = $thumb_name;
}else{
$img_name = $noimg;
}
echo $img_name;
http://www.dreamincode.net/forums/topic/11197-checking-if-file-exists-on-remote-server/ – 2012-02-06 17:02:10