我在PHP中有以下array
个数据。
Array (
[0] => stdClass Object (
[id] => 496
[debate_id] => 110
[student_id] => 170
[stakeholder_id] => 96
[submission_sequence] => 41
) [1] => stdClass Object (
[id] => 497
[debate_id] => 110
[student_id] => 171
[stakeholder_id] => 96
[submission_sequence] => 42
) [2] => stdClass Object (
[id] => 498
[debate_id] => 110
[student_id] => 172
[stakeholder_id] => 96
[submission_sequence] => 43
) [3] => stdClass Object (
[id] => 499
[debate_id] => 110
[student_id] => 173
[stakeholder_id] => 96
[submission_sequence] =>
) [4] => stdClass Object (
[id] => 500
[debate_id] => 110
[student_id] => 174
[stakeholder_id] => 97
[submission_sequence] => 41
) [5] => stdClass Object (
[id] => 501
[debate_id] => 110
[student_id] => 175
[stakeholder_id] => 97
[submission_sequence] => 42
) [6] => stdClass Object (
[id] => 502
[debate_id] => 110
[student_id] => 176
[stakeholder_id] => 97
[submission_sequence] => 43
) [7] => stdClass Object (
[id] => 503
[debate_id] => 110
[student_id] => 177
[stakeholder_id] => 97
[submission_sequence] =>
) [8] => stdClass Object (
[id] => 504
[debate_id] => 110
[student_id] => 178
[stakeholder_id] => 98
[submission_sequence] => 41
)
);
我希望这些数据显示为以下对象..
Object (
debate_id (
stakeholder_id (
Array (
[0] => stdClass Object (
[id] =>
[student_id] =>
[submission_sequence] =>
)
[1] => stdClass Object (
[id] =>
[student_id] =>
[submission_sequence] =>
)
[2] => stdClass Object (
[id] =>
[student_id] =>
[submission_sequence] =>
)
[3] => stdClass Object (
[id] =>
[student_id] =>
[submission_sequence] =>
)
)
)
stakeholder_id (
...
)
stakeholder_id (
...
)
stakeholder_id (
...
)
)
);
如何更改此数组以使其成为PHP中的此对象结构?
我希望这样做是为了增加它的可读性,并且我更容易从我的模型中将数据读入我的视图(因为我使用的是CodeIgniter框架)..