PHP 8.4.2 Released!

DirectoryIterator::isDot

(PHP 5, PHP 7, PHP 8)

DirectoryIterator::isDotDetermine if current DirectoryIterator item is '.' or '..'

说明

public DirectoryIterator::isDot(): bool

Determines if the current DirectoryIterator item is a directory and either . or ..

参数

此函数没有参数。

返回值

true if the entry is . or .., otherwise false

示例

示例 #1 A DirectoryIterator::isDot() example

This example will list all files, omitting the . and .. entries.

<?php
$iterator
= new DirectoryIterator(dirname(__FILE__));
foreach (
$iterator as $fileinfo) {
if (!
$fileinfo->isDot()) {
echo
$fileinfo->getFilename() . "\n";
}
}
?>

以上示例的输出类似于:

apple.jpg
banana.jpg
example.php
pears.jpg

参见

  • DirectoryIterator::getType()
  • DirectoryIterator::isDir()
  • DirectoryIterator::isFile()
  • DirectoryIterator::isLink()

添加备注

用户贡献的备注

此页面尚无用户贡献的备注。
To Top