file_exists使用字符串,但不是$ var

时间:2013-07-18 22:13:56

标签: php var file-exists

因此,我正在尝试制作一个动态链接页面,其中包含大量条目,指向图像的链接(如果存在),以及指向上传框的链接(如果不存在)。但是,出于某种原因,当我将变量传递给file_exists时,它返回false,即使直接传递相同的位置也返回true。例如:

$tempcomp = "dogs/big dogs/misty.puppy.jpg";

                if (file_exists($tempcomp))
                    {
                        echo "YES1";
                    }
                clearstatcache();
                if (file_exists ("dogs/big dogs/misty.puppy.jpg"))
                    {
                        echo "YES2";
                    }
                clearstatcache();

此代码返回YES2,即使两个语句都相同。是什么导致了这种行为?

0 个答案:

没有答案