PHP file_exists() 函數(shù)
定義和用法
file_exists() 函數(shù)檢查文件或目錄是否存在。
如果指定的文件或目錄存在則返回 true,否則返回 false。
語法
file_exists(path)
參數(shù) | 描述 |
---|---|
path | 必需。規(guī)定要檢查的路徑。 |
例子
<?php echo file_exists("test.txt"); ?>
輸出:
1
file_exists() 函數(shù)檢查文件或目錄是否存在。
如果指定的文件或目錄存在則返回 true,否則返回 false。
file_exists(path)
參數(shù) | 描述 |
---|---|
path | 必需。規(guī)定要檢查的路徑。 |
<?php echo file_exists("test.txt"); ?>
輸出:
1