Drupal 데이터베이스의 연관 배열을 json으로 인코딩 할 수있는 다차원 배열로 변환하려고합니다.배열에서 다차원 배열 만들기
$notifications =`
Array
(
[0] => Array
(
[rfp_id] => RFP-013-2014(C)
[notification_type] => due_date
)
[1] => Array
(
[rfp_id] => RFP-013-2014(C)
[notification_type] => changes
)
[2] => Array
(
[rfp_id] => RFP-013-2014(C)
[notification_type] => due_date
)
[3] => Array
(
[rfp_id] => RFP-014-2014(C)
[notification_type] => due_date
)
[4] => Array
(
[rfp_id] => RFP-014-2014(C)
[notification_type] => changes
)
)
나는 rfp_id 필드에 의해 그룹을 좋아하고 같은 끝낼 것 :
Array (
[0]=> Array (
["rfp_id"]=>"RFP-014-2014"
["notification_type"]=>
Array (
[0]=> "date_due"
[1]=> "changes"
)
)
)
가 어떻게이 배열을 반복이를 만드는 것
내가 시작?
기본적으로 http://stackoverflow.com/questions/25557428/custom-formatted-json-from-mysql-pdo-for-use-in-nvd3-js/25557722 –
과 같은 내용입니다. 어떤 노력을 했습니까? 이 작업을 수행? –
@MikeBrant 배열을 반복 할 때 몇 가지 옵션을 시도했습니다. 내가 가진 가장 가까운 것은 각 notification_type을 배열이 아닌 하나의 배열로 배열 한 것입니다. – sho