PHP Browse Catalog _php Tutorial

Source: Internet
Author: User
The Opendir () function opens a directory handle that can be used by Closedir (), Readdir (), and Rewinddir (). If successful, the function returns a directory stream, otherwise it returns false and an error. You can hide the output of the error by adding "@" before the function name.

PHP Tutorials Browse Directories

The Opendir () function opens a directory handle that can be used by Closedir (), Readdir (), and Rewinddir ().

If successful, the function returns a directory stream, otherwise it returns false and an error. You can hide the output of the error by adding "@" before the function name.

*/

$dir = Opendir ("Images");

List files in the images directory
while (($file = Readdir ($dir))!== false)
{
echo "FileName:". $file. "
";
}
Closedir ($dir);


Take a look at the modified directory browse implementation, use the table to browse the structure of the directory

Print ("















n ");//Create the header of the table print (" n ");p rint (" n ");p rint (" n ");p rint (" n "); $mydirectory = Opendir (". "); Create a handle to the operation directory//read out each subkey in the directory while ($entryname = Readdir ($mydirectory))//Through the loop, access each file of the directory {print (" "); Print (" "); Print (" "); Print (" n ");} Closedir ($mydirectory); Close the catalog print ("
filenamesize of File
$entryname");
Print (FileSize ($entryname));//Return file size
Print ("
n ");

http://www.bkjia.com/PHPjc/631727.html www.bkjia.com true http://www.bkjia.com/PHPjc/631727.html techarticle The opendir () function opens a directory handle that can be used by Closedir (), Readdir (), and Rewinddir (). If successful, the function returns a directory stream, otherwise it returns false as well as an err ...

  • 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.