我正在使用 PHP 并尝试创建一个看起来像这样的数组:
{
"aps" : {
"alert" : "Hey"
},
"custom_control" : {
"type" : "topic_comment",
"object":{
"topic_id":"123",
"topic_section":"test"
"plan_id":"456"
}
}
}
我的代码是:
<?php
$message = array(
"aps" => array(
"alert" => "hey"
),
"custom_control" => array(
"type" => "topic_comment",
"object" => array(
"topic_id" => "123",
"topic_section" => "abc",
"plan_id" => "456"
)
)
);
print_r($message);
?>
但打印出来的是这样的:
Array ( [aps] => Array ( [alert] => hey ) [custom_control] => Array ( [type] => topic_comment [object] => Array ( [topic_id] => 123 [topic_section] => abc [plan_id] => 456 ) ) )
看起来这与我想要的格式完全不同。还是我在某些方面不正确?
谢谢,亚历克斯