PHP is_dir() 函数

PHP 教程 · 2019-01-25 09:59:48

定义和用法

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");
  }
?>

上面的代码将输出:


images is a directory


点击查看所有 PHP 教程 文章: https://codercto.com/courses/l/5.html

查看所有标签

Programming Ruby

Programming Ruby

Dave Thomas、Chad Fowler、Andy Hunt / Pragmatic Bookshelf / 2004-10-8 / USD 44.95

Ruby is an increasingly popular, fully object-oriented dynamic programming language, hailed by many practitioners as the finest and most useful language available today. When Ruby first burst onto the......一起来看看 《Programming Ruby》 这本书的介绍吧!

Base64 编码/解码
Base64 编码/解码

Base64 编码/解码

SHA 加密
SHA 加密

SHA 加密工具

HEX HSV 转换工具
HEX HSV 转换工具

HEX HSV 互换工具