-1
我正在玩弄Slack /命令, 需要發回鬆弛的給定json看起來像這樣。將php數組轉換爲json
{
"text" : "hello world",
"attachments": [{
"text" : " this is information"
}]
}
我想通過這種方式複製這個。
$data = array(
"text" => "hello world",
"attachments" => array(
"text" => "this is information",
"author_name" => "masnad"
)
);
$this->output->set_content_type('application/json');
return $this->output->set_output(json_encode($data));
我只是不能讓方括號工作,所以鬆懈理解。
請求JSON是錯誤的。你需要大括號。 –
@RahulMeshram我試過json_encode,不起作用,你不能給這個消極點。 –
我沒有。 Huhhh。相反,我把你的問題的重複收回了!你怎麼能!請 – rahulsm