codecamp

xscandir()

作用:递归扫描目录并获取目录树。

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

参数:

  • $dirname 目录名
  • $sort 排序方式,0(升序,默认),1(降序)

返回值:

  • 返回指定目录的树形结构数组,如果目录名不是一个文件夹,则返回 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
        )
)
*/
array2xml()
xrmdir
温馨提示
下载编程狮App,免费阅读超1000+编程语言教程
取消
确定
目录

挂钩机制

关闭

MIP.setData({ 'pageTheme' : getCookie('pageTheme') || {'day':true, 'night':false}, 'pageFontSize' : getCookie('pageFontSize') || 20 }); MIP.watch('pageTheme', function(newValue){ setCookie('pageTheme', JSON.stringify(newValue)) }); MIP.watch('pageFontSize', function(newValue){ setCookie('pageFontSize', newValue) }); function setCookie(name, value){ var days = 1; var exp = new Date(); exp.setTime(exp.getTime() + days*24*60*60*1000); document.cookie = name + '=' + value + ';expires=' + exp.toUTCString(); } function getCookie(name){ var reg = new RegExp('(^| )' + name + '=([^;]*)(;|$)'); return document.cookie.match(reg) ? JSON.parse(document.cookie.match(reg)[2]) : null; }