PHP is_dir() 函數
PHP is_dir() 函數

定義和用法
is_dir() 函數檢查指定的文件是否是一個目錄。
如果目錄存在,該函數返回 TRUE。
語法
is_dir(file)
參數 | 描述 |
---|---|
file | 必需。規定要檢查的文件。 |
提示和注釋
注釋:該函數的結果會被緩存。請使用 clearstatcache() 來清除緩存。
實例
<?php
$file = "images";
if(is_dir($file))
{
echo ("$file is a directory");
}
else
{
echo ("$file is not a directory");
}
?>
$file = "images";
if(is_dir($file))
{
echo ("$file is a directory");
}
else
{
echo ("$file is not a directory");
}
?>
上面的代碼將輸出:
images is a directory

相關文章
- PHP 安裝
- PHP 語法
- PHP 魔術常量
- PHP $_POST 變量
- PHP 文件上傳
- PHP JSON
- PHP array() 函數
- PHP array_change_key_case() 函數
- PHP array_column() 函數
- PHP array_diff_uassoc() 函數
- PHP array_filter() 函數
- PHP array_key_first() 函數
- PHP array_keys() 函數
- PHP array_map() 函數
- PHP array_merge_recursive() 函數
- PHP array_values() 函數
- PHP extract() 函數
- PHP rsort() 函數
- PHP shuffle() 函數
- PHP sizeof() 函數