php自定义返回json数据函数

public function result($errno, $message, $data = "") {
   ob_clean();//清空输出缓冲区
   exit(json_encode(array(
      "errno" => $errno,
      "message" => $message,
      "data" => $data,
   )));
}
return $this->result("10014", "redis connect fail", "");