如何从PHP脚本生成此结构文件JSON?
示例JSON:
{
"messages":[
{
"attachment":{
"type":"image",
"payload":{
"url":"#"
}
}
}
]
}

谢谢:)
答案 0 :(得分:1)
这应该有效。
$a = ["messages" => [["attachment" => ["type" => "image", "payload" => ["url" => "#"]]]]];
$b = json_encode ($a);