file_exists()不运行

1 php

$myfilepath =  SITEROOT."/uploads/vaibhav_photo/thumbnail/".$user_avatar['thumbnail'];
if(file_exists($myfilepath))
{
  echo "file exist";
}
else
{
  echo "file does not exist";
}
Run Code Online (Sandbox Code Playgroud)

即使文件存在,它总是去其他部分.

如果有人在PHP中有替代选项,请尽快回复,

Pek*_*ica 6

file_exists仅适用于文件路径.http://不支持网址.

  • @Sarfraz nope:来自file_exists的手册页:"从PHP 5.0.0开始,此函数也可以与一些URL包装器一起使用.有关哪些包装器支持stat()系列功能的列表,请参阅支持的协议和包装器. " http://不*支持`stat()`系列功能. (2认同)