file_exists() 即使文件存在(远程 URL),也返回 false
2022-08-30 20:21:08
即使提供的图像进行检查,我的返回为假。为什么?file_exists()
https://www.google.pl/logos/2012/haring-12-hp.png
下面我展示了完全失败的PHP代码,准备在localhost上触发:
$filename = 'https://www.google.pl/logos/2012/haring-12-hp.png';
echo "<img src=" . $filename . " />";
if (file_exists($filename)) {
echo "The file $filename exists";
} else {
echo "The file $filename does not exist";
}