directory search
Array Array Helper Benchmarking Benchmarking Class Caching Caching Driver Calendaring Calendaring Class CAPTCHA CAPTCHA Helper Config Config Class Cookie Cookie Helper Database Connecting to your Database Custom Function Calls Database Caching Class Database Configuration Database Forge Class Database Metadata Database Quick Start: Example Code Database Reference Database Utility Class DB Driver Reference Generating Query Results Queries Query Builder Class Query Helper Methods Transactions Date Date Helper Directory Directory Helper Download Download Helper Email Email Class Email Helper Encrypt Encrypt Class Encryption Encryption Library File File Helper File Uploading File Uploading Class Form Form Helper Form Validation Form Validation FTP FTP Class Functions compatibility_functions common_functions HTML HTML Helper HTML Table HTML Table Class Image Manipulation Image Manipulation Class Inflector Inflector Helper Input Input Class Javascript Javascript Class Language Language Class Language Helper Loader Loader Class Migrations Migrations Class Number Number Helper Output Output Class Pagination Pagination Class Path Path Helper Security Security Class Security Helper Session Session Library Shopping Cart Shopping Cart Class Smiley Smiley Helper String String Helper Template Parser Template Parser Class Text Text Helper Trackback Trackback Class Typography Typography Class Typography Helper Unit Testing Unit Testing Class URI URL User Agent XML XML-RPC and XML-RPC Server Zip Encoding Zip Encoding Class XML-RPC and XML-RPC Server Classes XML Helper User Agent Class URL Helper URI Class
characters

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

  • 加载此助手

  • 可用职能

加载此助手

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

$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)

Previous article: Next article: