This article mainly introduces the PHP glob() function, which has certain reference value. Now I share it with you. Friends in need can refer to it
PHP Filesystem function
glob(pattern,flags)
Description | |
---|---|
Required. Specifies the search mode. | |
Optional. Specifies special settings.
Note: GLOB_ERR was added in PHP 5.1. |
##Example
<?php print_r(glob("*.txt")); ?>
Output is similar:
Array ( [0] => target.txt [1] => source.txt [2] => test.txt [3] => test2.txt )
Example 2
<?php print_r(glob("*.*")); ?>
Array ( [0] => contacts.csv [1] => default.php [2] => target.txt [3] => source.txt [4] => tem1.tmp [5] => test.htm [6] => test.ini [7] => test.php [8] => test.txt [9] => test2.txt )
Related recommendations:
const and global in phpThe above is the detailed content of PHP glob() function. For more information, please follow other related articles on the PHP Chinese website!