private $errors = array(
400 => '参数错误',
401 => '操作失败',
402 => '未查询到数据'
);
private function success($content = ''){
$ret_data = array(
'code' => 200,
'message' => 'success',
'content' => empty($content) ? '' : $content,
);
std_json_return($ret_data);
}
private function fail($error_code){
$ret_data = array(
'code' => $error_code,
'message' => $this->errors[$error_code],
);
std_json_return($ret_data);
}
function std_json_return($arr_data)
{
$arr_data = is_array($arr_data) ? $arr_data : array($arr_data);
exit(json_encode($arr_data));
}