PHP infinite directory traversal code

WBOY
Release: 2016-07-25 08:54:18
Original
905 people have browsed it
  1. if(isset($_GET['id']))

  2. {
  3. $s=$_GET['id'];
  4. chdir($s);
  5. }
  6. echo 'Currently in'.getcwd(),'
    ';
  7. $a=opendir('.');
  8. while($c=readdir($a))
  9. {
  10. if(is_dir ($c))
  11. {
  12. $w=getcwd().'\'.$c;
  13. echo $c."Open";
  14. }
  15. else
  16. {
  17. echo $c.'
    ';
  18. }

  19. }

  20. ?>
Copy code

>>> Articles you may be interested in: php traverses the directory and all files under it php traverses all directories and files under the specified path (example) PHP class for traversing folders and files Small example of php traversing directories and renaming them Small example of PHP traversing all files in a directory Small example of PHP traversing files and folders php code to traverse all files and subfolders in a directory PHP example code for traversing file directories and clearing files in directories Two functions for php to recursively traverse directories PHP function to traverse all files in a directory Notes on the is_file() and is_dir() functions when traversing directories php directory traversal small function PHP function to recursively traverse all files in a directory



Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template