Dir function of the directory file handler-converts the directory name to an object

Source: Internet
Author: User
Tags rewind

Dir Function-Converts a directory name to an object

The Dir function converts a directory name to an object and returns. The returned object can call 2 properties and 3 methods.

The properties and methods that can be called are as shown in the table:

TD valign= "Top" >

properties and methods

properties and methods

handle properties

Returns the directory ID

rewind () method

Reset Directory identity

path properties

return hit Open Directory path

close () method

Close directory

read () method

Read directory

 ,

 

The example applies the Dir () function to get the directory ID, path, and name of all subdirectories and files in that directory.

<? PHP       $dir = Dir ("C:/windows");       Echo "This directory is identified as:". $dir->handle. " </br> ";       Echo "The directory's path is:". $dir->path. " </br> "; Echo "All subdirectories and files of this directory are as follows:"; while ($read = $dir, read ())       Echo $read. " </br> "; $dir->rewind (); $dir->close ();


Dir function of the directory file handler-converts the directory name to an object

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.