因此,我使用Directory Helper中的directory_map函數,並且想知道如何編輯該函數(或者擴展它或某個函數),以便將它排序它給了我多維數組。如何在CodeIgniter中對directory_helper創建的數組進行排序
這是它當前生成的數組;
Array
(
[publications] => Array
(
[policy_documents] => Array
(
[_careers] => Array
(
[0] => careers.pdf
)
[_background_quality_reports] => Array
(
[0] => industry.pdf
[1] => international.pdf
[2] => departmental_resources.pdf
[3] => contracts.pdf
[4] => research_and_development.pdf
[5] => trade.pdf
)
[_pre_release_access_list] => Array
(
[0] => pre_release_access_list.pdf
)
)
[people] => Array
(
[health] => Array
(
[very_serious_injuries] => Array
(
[_1_january_2013] => Array
(
[0] => 1_january_2013.pdf
)
)
)
[military] => Array
(
[quarterly_manning_report] => Array
(
[_1_january_2013] => Array
(
[0] => 1_january_2013.pdf
)
)
[monthly_manning_report] => Array
(
[_20110201_1_february_2011] => Array
(
[0] => 1_february_2011.xls
[1] => key_points.html
[2] => 1_february_2011.pdf
)
[_20110301_1_march_2011] => Array
(
[0] => 1 March 2011.pdf
)
[_20110501_1_may_2011] => Array
(
[0] => 1 May 2011.pdf
)
[_20110401_1_april_2011] => Array
(
[0] => 1 April 2011.pdf
)
)
)
[civilian] => Array
(
[civilian_personnel_report] => Array
(
[_1_april_2012] => Array
(
[0] => 1_april_2012.pdf
)
[_1_october_2012] => Array
(
[0] => 1_october_2012.pdf
)
[_1_january_2013] => Array
(
[0] => 1_january_2013.pdf
[1] => key_points.html
)
[_1_july_2012] => Array
(
[0] => 1_july 2012.pdf
)
)
)
[search_and_rescue] => Array
(
[monthly] => Array
(
[_1_February_2013] => Array
(
[0] => 1_february_2013.pdf
)
)
[annual] => Array
(
[_2012] => Array
(
[0] => 2012.pdf
)
)
[quarterly] => Array
(
[_q3_2012] => Array
(
[0] => q3_2012.pdf
)
)
)
)
[estate] => Array
(
)
)
)
這是有點混亂,但你明白了。任何在我的模型中圍繞變量包裝sort()或asort()的嘗試都會導致錯誤。這就是爲什麼我認爲我可能需要編輯此功能,或者也許我創建一個新的...
我不這麼認爲ASORT可以排序**多維數組**。 U是否使用'array_multisort()'? – 2013-04-26 13:10:13