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.
opendir() を使用しようとすると、常に警告が表示されますが、フォルダーが存在しません。このエラーを処理し、ディレクトリを開く前にフォルダが存在するかどうかを確認するにはどうすればよいですか?
is_dir($directory)
ファイル名が存在し、ディレクトリである場合は TRUE を返し、それ以外の場合は FALSE を返します。
ディレクトリが存在するかどうかを確認するには、is_dir()
is_dir()
if(is_dir($dir)){ // code }