php搜索当前目录全体文件,代码如下:复制代码
代码如下:$array = glob; print_r; /* Array ( [0] => 1.php [1]
=> 10.php [2] => 11.php [3] => 2.asp [4] => 3.asp
[5] => 4.aspx [6] => 5.html [7] => 6.php [8] =>
7.php [9] => 8.php [10] => 9.php )
*/寻找以.php结果的php文件,代码如下:复制代码 代码如下:$array = glob; print_r; /*
Array ( [0] => 1.php [1] => 10.php [2] => 11.php [3]
=> 6.php [4] => 7.php [5] => 8.php [6] => 9.php )
*/寻找包涵有php,aspx 文件,代码如下:复制代码 代码如下:$files =
glob(‘*.{php,aspx}’, GLOB_BRACE); print_r; /* Array ( [0] =>
1.php [1] => 10.php [2] => 11.php [3] => 6.php [4]
=> 7.php [5] => 8.php [6] => 9.php [7] => 4.aspx )
*/在钦命目录寻找以1开的php文件复制代码
代码如下:$files = glob; print_r; /* Array ( [0] => ../05-15/1.php
[1] => ../05-15/10.php [2] => ../05-15/11.php )
*/重返文件的相对路线,代码如下:复制代码
代码如下:$files = array_map; print_r; Array ( [0] =>
D:www.jb51.net-15.php [1] => D:www.jb51.net-15.php [2] =>
D:www.jb51.net-15 .php State of Qatarglob函数更加强有力,能够依据某种方式找出文件。

正文实例汇报了php使用glob函数神速查询内定目录文件的方式。分享给咱们供大家参照他事他说加以考察。具体如下:

目的在于本文所述对大家的PHP程序设计有所支持。

发表评论

电子邮件地址不会被公开。 必填项已用*标注