Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
ファイルが存在するかどうかを確認する必要がありますが、拡張子がわかりません。
IE私がやりたいこと:
if(file_exists('./uploads/filename')): // do something endif;
もちろん、拡張機能がないため、機能しません。拡張子はjpg、jpeg、png、gifのいずれかになります
ループを実行せずにこれを行う方法のアイデアはありますか?
あなたはしなければならないでしょうglob():
glob():
$result = glob ("./uploads/filename.*");
何かが含まれているかどうかを確認し$resultます。
$result