非常教程

Codeigniter 3参考手册

目录 | Directory

目录助手 | Directory Helper

目录帮助文件包含有助于使用目录的功能。

  • 加载此助手
  • 可用职能

加载此助手

使用以下代码加载此助手:

$this->load->helper('directory');

可用职能

现有下列职能:

directory_map($source_dir[, $directory_depth = 0[, $hidden = FALSE]])

参数:

$ source_dir(string) - 源目录的路径$ directory_depth(int) - 要遍历的目录的深度(0 =完全递归,1 =当前目录等)$ hidden(bool) - 是否包含隐藏的目录

返回:

一组文件

返回类型:

排列

  • $ source_dir字符串) - 源目录的路径
  • $ directory_depthint) - 要遍历的目录的深度(0 =完全递归,1 =当前目录等)
  • $ hiddenbool) - 是否包含隐藏的目录
Returns:  An array of files
Return type:  array
Examples:

$ map = directory_map('./ mydirectory /');

路径几乎总是相对于您的主要index.php文件。

目录中包含的子文件夹也将被映射。如果你想控制递归深度,你可以使用第二个参数(整数)。深度为1将只映射顶层目录:

$ map = directory_map('./ mydirectory /',1);

默认情况下,隐藏文件不会包含在返回的数组中。要覆盖此行为,可以将第三个参数设置为true(布尔值):

$ map = directory_map('./ mydirectory /',FALSE,TRUE);

每个文件夹名都是一个数组索引,而其包含的文件将被数字索引。下面是一个典型数组的示例:

Array(libraries => Array(0 => benchmark.html 1 => config.html“database /”=> Array(0 => query_builder.html 1 => binds.html 2 => configuration.html 3 =>连接)。 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)

目录 | Directory相关

Codeigniter 3

CodeIgniter 是一个PHP MVC框架,特点是超轻量级、有数据加密、有灵活URI路由等。对于 PHP 程序员来说,它小巧但功能强大。

主页 https://codeigniter.com/
源码 https://github.com/bcit-ci/CodeIgniter
版本 3
发布版本 3.1.5