当我使用方法post的json输入print_r()我的json输入时,我有一个具有这种结构的数组
public function ajax_add($mode) {
echo "<pre>";
print_r($this->input->post());
echo "</pre>";
}
这是我的print_r结果
Array
(
[{"thang":"2019","kd_kegiatan":"2409","kd_output":"014","kd_sub_output":"002","kd_komponen":"307","kd_sub_komponen":"B","nama_sub_komponen":"","kd_dept":"033","kd_unit":"04","kd_program":"08","id_paket":""}] =>
[0] =>
)
我需要将上面的json数据转换为关联数组 例如
array(
"thang"=>2019,
"kd_kegiatan"=>2409
"kd_output"=>014,
"etc"=>"....."
)
但是我不知道这样做。因为第一个数组没有索引。该如何解决?