W3Cschool
恭喜您成為首批注冊(cè)用戶(hù)
獲得88經(jīng)驗(yàn)值獎(jiǎng)勵(lì)
目錄輔助函數(shù)文件包含了一些幫助你處理目錄的函數(shù)。
該輔助函數(shù)通過(guò)下面的代碼加載:
$this->load->helper('directory');
該輔助函數(shù)有下列可用函數(shù):
directory_map($source_dir[, $directory_depth = 0[, $hidden = FALSE]])
參數(shù):
返回: An array of files
返回類(lèi)型: array
舉例:
$map = directory_map('./mydirectory/');
注解
路徑總是相對(duì)于你的 index.php 文件。
如果目錄內(nèi)含有子目錄,也將被列出。你可以使用第二個(gè)參數(shù)(整數(shù)) 來(lái)控制遞歸的深度。如果深度為 1,則只列出根目錄:
$map = directory_map('./mydirectory/', 1);
默認(rèn)情況下,返回的數(shù)組中不會(huì)包括那些隱藏文件。如果需要顯示隱藏的文件, 你可以設(shè)置第三個(gè)參數(shù)為 true
$map = directory_map('./mydirectory/', FALSE, TRUE);
每一個(gè)目錄的名字都將作為數(shù)組的索引,目錄所包含的文件將以數(shù)字作為索引。 下面有個(gè)典型的數(shù)組示例:
Array (
[libraries] => Array
(
[0] => benchmark.html
[1] => config.html
["database/"] => Array
(
[0] => query_builder.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
)
Copyright©2021 w3cschool編程獅|閩ICP備15016281號(hào)-3|閩公網(wǎng)安備35020302033924號(hào)
違法和不良信息舉報(bào)電話(huà):173-0602-2364|舉報(bào)郵箱:jubao@eeedong.com
掃描二維碼
下載編程獅App
編程獅公眾號(hào)
聯(lián)系方式:
更多建議: