php把数据转换为json格式 public function demos(){ $data=[ 'state'=>1, 'msg'=>'更新成功' ]; return json_encode($data); }