©
이 문서에서는 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' );
?>