我有一个类似的阵列:
使用每个循环我得到这两个数组
Array
(
[0] => Array
(
[Easycase] => Array
(
[id] => 6119
[uniq_id] => 94e163c35e99944b30a452a2220cbc3f
[case_no] =>1
[title] => Task 1
[gantt_start_date] => 2015-01-26
[due_date] => 2015-01-29
)
)
)
Array ( [0] => Array ( [Easycase] => Array ( [id] => 6121 [uniq_id] => b1825674988deb63e0ee7204d6ab0d9a [case_no] => 2
[title] => Task 2 [assign_to] => 878 [gantt_start_date] => 2015-01-26 [due_date] => 2015-01-29 )) )
I want to convert this array which looks like below
Array ( [0] => Array ( [id] => 1 [name] => Milestone 1 [series] => Array ( [0]=>Array( [id] => 6119 [name] => Task 2 [gantt_start_date] => 2015-01-26 [due_date] => 2015-01-29 ) [1]=>Array( [id]=>6121 [name] => Task 1 [gantt_start_date] => 2015-01-26 [due_date] => 2015-01-29 ) )
)
答案 0 :(得分:1)
您可以使用以下函数来格式化内部数组:
$easycase = Set::classicExtract($easycase, '{n}.User');
This will return array with below format
Array
(
[0]=>Array(
[id] => 6119
[uniq_id] => 94e163c35e99944b30a452a2220cbc3f
[case_no] =>1
[title] => Task 1
[gantt_start_date] => 2015-01-26
[due_date] => 2015-01-29
)
[1]=>Array(
[id] => 6121
[uniq_id] => b1825674988deb63e0ee7204d6ab0d9a
[case_no] => 2
[title] => Task 2
[assign_to] => 878
[gantt_start_date] => 2015-01-26
[due_date] => 2015-01-29
)
)