發表文章

目前顯示的是有「檢查目錄是否存在」標籤的文章

[PHP] 檔案或目錄函式

file_exists( ):檢查檔案或目錄是否存在 is_file( ):檢查檔案是否存在 is_dir( ):檢查目錄是否存在 mkdir():建立目錄 unlink( ):刪除檔案 rmdir():刪除目錄 大致用法如下: $file = $_SERVER[DOCUMENT''].'/files/test.txt'; if (file_exists($file)) { echo "檔案存在"; } else { echo "無檔案"; } 參考資料: https://www.php.net/manual/en/function.file-exists.php https://www.php.net/manual/en/function.is-file.php https://www.php.net/manual/en/function.is-dir.php https://www.php.net/manual/en/function.mkdir.php https://www.php.net/manual/en/function.unlink.php https://www.php.net/manual/en/function.rmdir.php