Home >Backend Development >PHP Tutorial >php lists all php files in the current directory

php lists all php files in the current directory

WBOY
WBOYOriginal
2016-07-25 08:44:141103browse

php lists all php files in the current directory

  1. //Define directory for files listing
  2. //original example
  3. //$files = glob('/path/to/dir/* .xml');
  4. $files = glob('*.php');
  5. //to limit what is displayed you can use a diff listing:
  6. //$files = array_diff($files, array('index.php ','opendb.php'));
  7. foreach ($files as $value) {
  8. echo "".$value."< ;br>";
  9. }
  10. ?>
Copy code

directory, php


Statement:
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