有谁知道为什么以下不工作?
$file = 'images/thumbs/1%20-%20Copy.jpg';
if(!file_exists($file)){
die('NOT THERE');
}
echo 'Yes its there.';
Run Code Online (Sandbox Code Playgroud)
问题在于空间.我检查过该文件存在,dbl检查了n三重检查即时通讯.:(
救命
file_exists适用于文件系统而不是HTTP.所以%20不会被认为是空间,而是字面意思%20; 改为使用空格:
$file = 'images/thumbs/1 - Copy.jpg';
Run Code Online (Sandbox Code Playgroud)