PHP Infinite Traversal Directory Code instance

Source: Internet
Author: User
In the development of PHP, we will often encounter a variety of problems, today's small series want to realize the infinite traversal of PHP directory, it is difficult to implement this method, after searching some information on the Internet, just method PHP unlimited traverse directory is not so difficult, now look at it. The functions used are: Isset () Determines whether a variable is defined chdir () changes the current directory to the specified directory. Opendir () to open the directory. Readdir () reads the directory. GETCWD (). Gets the current directory. It also uses the for if get pass value about these things: here is the code: ";//when the absolute path to open will be passed out with chdir switch to the directory to open}else {$w =base64_encode (GETCWD (). \ \ '. $c);//The current path plus the directory name is the absolute path to the directory echo "$c". " Open it
";///when the absolute path to open will be passed out with chdir switch to the directory to be opened}}}}} else {echo" $c not a directory
"; }}? > above is the entire content of PHP infinite traversal directory, everyone in the study need to pay attention to a problem, is the path must be absolute path, do not make a mistake, hope to help everyone.
Recommended reading: MONGO two-time package first
  • 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.