php is_dir 无效
PHP is_dir()函数 (PHP is_dir() function)
The full form of is_dir is "Is Directory", the function is_dir() is used to check whether a file system is a directory or whether a directory exists or not.
is_dir的完整格式为“ Is Directory” , 函数is_dir()用于检查文件系统是否为目录或目录是否存在。
Syntax:
句法:
is_dir(directory);
Parameter(s):
参数:
directory – Directory name (or path) to be checked whether it exists or not.
directory –要检查目录名称(或路径)是否存在。
Return value:
返回值:
It returns a Boolean value, "TRUE" (1) – if directory exists or "FALSE" (null) – if the directory does not exist.
如果目录存在,则返回布尔值“ TRUE”(1)-如果目录不存在,则返回“ FALSE”(空)。
Example: PHP code to check whether a directory exists or not
示例:检查目录是否存在PHP代码
<?php
//creating directories
mkdir("/home/folder1");
mkdir("/home/folder2");
mkdir("/home/folder3");
//checking directories are exist or not
echo is_dir("/home/folder1")."<br/>";
echo is_dir("/home/folder2")."<br/>";
echo is_dir("/home/folder3")."<br/>";
echo is_dir("/home/folder4")."<br/>";
//checking through the conditions
if(is_dir("/home/folder1"))
echo "/home/folder1 exists"."<br/>";
else
echo "/home/folder1 does not exist"."<br/>";
if(is_dir("/home/folder2"))
echo "/home/folder2 exists"."<br/>";
else
echo "/home/folder2 does not exist"."<br/>";
if(is_dir("/home/folder3"))
echo "/home/folder3 exists"."<br/>";
else
echo "/home/folder3 does not exist"."<br/>";
if(is_dir("/home/folder4"))
echo "/home/folder4 exists"."<br/>";
else
echo "/home/folder4 does not exist"."<br/>";
?>
Output
输出量
1
1
1
/home/folder1 exists
/home/folder2 exists
/home/folder3 exists
/home/folder4 does not exist
翻译自: https://www.includehelp.com/php/is_dir-function-with-example.aspx
php is_dir 无效