本教程操作环境:windows7系统、php7.1版、dell g3电脑
在php中,可以利用is_file()来判断是不是文件。
is_file() 函数检查指定的文件是否是常规的文件。语法:
is_file(file)
参数file:必需。规定要检查的文件。
如果文件是常规的文件,该函数返回 true。
示例:
<?phpheader("content-type:text/html;charset=utf-8");$file = "test.txt";if(is_file($file)){echo ("$file 是文件");}else{echo ("$file 不是文件");}?>
输出结果:
推荐学习:《php视频教程》
以上就是php怎么判断是不是文件的详细内容。
