目录辅助函数
目录辅助函数文件包含处理目录的函数。
载入这个辅助函数
请使用如下代码载入这个辅助函数:
以下函数可以使用: ## directory_map('source directory') 这个函数将读取第一个参数所给出的路径的目录,并且返回该目录所包含文件的数据。示例如下:
$this->load->helper('directory');
**注意:** 路径总是相对于你的index.php文件。 如果目录含有子文件夹,也将被列出。你可以使用第二个参数(整数)来控制递归的深度。如果深度为 1,则只列出根目录:
$map = directory_map('./mydirectory/');
默认情况下,返回的数组中不会包括那些隐藏文件。为了覆盖此行为(即显示隐藏的文件--译者加),你可以设置第三个参数为 _true_ (boolean):
$map = directory_map('./mydirectory/', 1);
每一个文件夹的名字都将作为数组的索引,文件夹所包含的文件将以数字作为索引。下面有个典型的数组示例:
$map = directory_map('./mydirectory/', 0, TRUE);
Array
(
[libraries] => Array
(
[0] => benchmark.html
[1] => config.html
[database] => Array
(
[0] => active_record.html
[1] => binds.html
[2] => configuration.html
[3] => connecting.html
[4] => examples.html
[5] => fields.html
[6] => index.html
[7] => queries.html
)
[2] => email.html
[3] => file_uploading.html
[4] => image_lib.html
[5] => input.html
[6] => language.html
[7] => loader.html
[8] => pagination.html
[9] => uri.html
)
翻译贡献者:Hex, Jacklee, slqingqing, sydcurie, yinzhili
当前内容版权归 CodeIgniter中国 或其关联方所有,如需对内容或内容相关联开源项目进行关注与资助,请访问 CodeIgniter中国 .