if you wanna to encode a json object as the json response, you must set all the property of this objec in public, or it will not work. Like this:
class JsonResponseData{ public $msg; public $data; public $errMsg; public function setMsg($msg){ $this->msg=$msg; } public function get(){ return $this->msg; } public function setData($data){ $this->data=$data; } public function getData(){ return $this->data; } public function setErrMsg($errMsg){ $this->errMsg=$errMsg; } public function getErrMsg(){ return $this->errMsg; } }before i set them in private, and i always get a void response object. after i set them to public ,everything works fine.
评论
发表评论