©
Ce document utilise Manuel du site Web PHP chinois Libérer
(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' );
?>