PHP Dir Function Example Tutorial _php tutorial

Source: Internet
Author: User
Tags rewind
Pseudo object-oriented mechanism of reading DIR. The given dir is open. Two properties available once Dir has been opened. The processing property can be used with other Dir functions such as Readdir (), Rewinddir () and Closedir ()

Dir-returns an instance of the Directory class,

Describe
Dir
Dir
string $ path;
Resources $ processing;
String changed to (invalid)
Invalid Rewind (invalid)
Invalid close (invalid)

Pseudo object-oriented mechanism of reading DIR. The given dir is open. Two properties available once Dir has been opened. The processing property can be used with other Dir functions, such as Readdir (), Rewinddir () and Closedir (). The Path property is set to the dir opening of the path. There are three ways: reading, rewind and close.

Instance

Example of # DIR ()

Please note the fashion, where Dir:: Read () The return value is checked in the following example. Whether we explicitly test the return value is the same (equivalent to the same type-see the comparison operator for more information) false, because otherwise, any Dir entry whose name evaluates to False will stop the loop.

$d = Dir ("/etc/php5");
echo "Handle:". $d->handle. "N";
echo "Path:". $d->path. "N";
while (false!== ($entry = $d->read ())) {
echo $entry. " n ";
}
$d->close ();
?>


http://www.bkjia.com/PHPjc/445491.html www.bkjia.com true http://www.bkjia.com/PHPjc/445491.html techarticle pseudo object-oriented mechanism of reading DIR. The given dir is open. Two properties available once Dir has been opened. The processing property can be used with other Dir functions, such as Readdir (), Rewinddir () ...

  • Related Article

    Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.