-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