发布于 2022-12-25 12:27:35 浏览 378 次
语法:
is_file(file);
参数:
$file:文件路径,必须。
案例:
<?php
$file = "test.txt";
if(is_file($file))
{
echo ("文件存在!");
}
else
{
echo ("文件不存在");
}
?>
说明:
该函数的结果会被缓存。请使用 clearstatcache() 来清除缓存。
is_file()
2、
语法:
is_dir($file);
参数:
$file:目录路径,必须。
案例:
<?php
$file = "images";
if(is_dir($file))
{
echo ("目录存在!");
}
else
{
echo ("目录不存在!");
}
?>
说明:
该函数的结果会被缓存。请使用 clearstatcache() 来清除缓存。
is_dir()
3、
语法:
file_exists($file);
参数:
$file:文件路径,必须。
案例:
<?php
echo file_exists("test.txt");
?>
file_exists()