xscandir()

2018-06-30 18:31 更新

作用:遞歸掃描目錄并獲取目錄樹。

語法: array xscandir(string $dirname[, int $sort])

參數(shù):

  • $dirname 目錄名
  • $sort 排序方式,0(升序,默認(rèn)),1(降序)

返回值:

  • 返回指定目錄的樹形結(jié)構(gòu)數(shù)組,如果目錄名不是一個文件夾,則返回 false。

示例:

<?php
print_r(xscandir(__ROOT__.'mod'));
/** 將輸出
Array
(
    [0] => .
    [1] => ..
    [classes] => Array
        (
            [0] => .
            [1] => ..
            [2] => category.class.php
            [3] => comment.class.php
            [4] => file.class.php
            [5] => mod.class.php
            [6] => image.class.php
            [7] => mail.class.php
            [8] => database.class.php
            [9] => post.class.php
            [10] => user.class.php
        )
    [common] => Array
        (
            [0] => .
            [1] => ..
            [2] => init.php
            [3] => install.php
            [4] => recover.php
            [5] => update.php
        )
    [config] => Array
        (
            [0] => .
            [1] => ..
            [2] => config.php
            [3] => database.php
            [4] => mime.ini
            [5] => static-uri.php
        )
    [functions] => Array
        (
            [0] => .
            [1] => ..
            [2] => category.func.php
            [3] => comment.func.php
            [4] => common.func.php
            [5] => extension.func.php
            [6] => file.func.php
            [7] => mod.func.php
            [8] => post.func.php
            [9] => user.func.php
        )
    [lang] => Array
        (
            [0] => .
            [1] => ..
            [2] => zh_cn.php
        )
)
*/
以上內(nèi)容是否對您有幫助:
在線筆記
App下載
App下載

掃描二維碼

下載編程獅App

公眾號
微信公眾號

編程獅公眾號