OKプログラマー、新年の前にこれを理解したいと思います。写真が存在する場合にのみ表示したいのですが、そうでない場合はデフォルトの写真を使用します。これが常に正しく「FileExists」を返す私のコードです
<?php
$photolocation = '../wp-content/gallery/playerphotos/Joe Smith.jpg';
if (!file_exists($photolocation))
{
echo "File exists";
}
else
{
echo "File does not exist";
}
?>
に変更するphotolocation
と:
$photolocation = '../wp-content/gallery/playerphotos/XXX Smith.jpg';
「ファイルが存在します」と誤って表示されます。
条件!file_existsが常に正の値を返す理由がわかりません。