我不知道任何PHP,但我需要让我的JSON对象看起来有某种方式
$body['aps'] = array(
'alert' => "look at this stuff",
'sound' => 'default'
);
$payload = json_encode($body);
如何使JSON对象看起来像
{
"aps":
{
"alert": "look at this stuff",
"sound": 'default'
},
"view": "wc1"
}
答案 0 :(得分:4)
您是否尝试在$body
中插入另一个值?
$body['aps'] = array(
'alert' => "look at this stuff",
'sound' => 'default'
);
$body['view'] = 'wc1';
$payload = json_encode($body);