我需要检查文件是否在指定位置的HDD上($ path.$ file_name).
哪个是is_file()和file_exists()函数之间的区别,哪个更好/更快在PHP中使用?
我能找到的最好的,if fclose fopen类型的东西,使页面加载非常缓慢.
基本上我要做的是以下内容:我有一个网站列表,我想在他们旁边显示他们的favicon.但是,如果一个站点没有,我想用另一个图像替换它而不是显示损坏的图像.
if (!(file_exists(http://mysite.com/images/thumbnail_1286954822.jpg))) {
$filefound = '0';
}
Run Code Online (Sandbox Code Playgroud)
为什么这不起作用?
这是我的代码.
$filename = "$myMedia catalog/category/ $myImage.png";
$filename = str_replace(" ", "", $filename);
if (file_exists($filename)) {
echo "The file $filename exists";
} else {
echo "The file $filename does not exist";
}
Run Code Online (Sandbox Code Playgroud)
的variable上述输出http://50.87.6.244/~storeupp/media/catalog/category/Game_Used.png存在哪些一样.但是,它说它不存在.
知道为什么吗?