©
本文档使用 PHP中文网手册 发布
(PHP 5)
DirectoryIterator::isLink — Determine if current DirectoryIterator item is a symbolic link
Determines if the current DirectoryIterator item is a symbolic link.
此函数没有参数。
Returns TRUE
if the item is a symbolic link, otherwise FALSE
Example #1 A DirectoryIterator::isLink() example
This example contains a recursive function for removing a directory tree.
<?php
function removeDir ( $path ) {
$dir = new DirectoryIterator ( $path );
foreach ( $dir as $fileinfo ) {
if ( $fileinfo -> isFile () || $fileinfo -> isLink ()) {
unlink ( $fileinfo -> getPathName ());
} elseif (! $fileinfo -> isDot () && $fileinfo -> isDir ()) {
removeDir ( $fileinfo -> getPathName ());
}
}
rmdir ( $path );
}
removeDir ( 'foo' );
?>