标签:img class res mes 控制器 think inf cape return
function jsons($code, $message = ‘‘, $data = array()) { if(!is_numeric($code)) { return ‘‘; } $result = array( ‘code‘ => $code, ‘message‘ => urlencode($message), ‘data‘ => $data ); echo urldecode(json_encode($result,JSON_UNESCAPED_UNICODE)); exit; }
控制器的写法:
return jsons(1,‘返回数据成功!‘,$data);exit;
效果:
标签:img class res mes 控制器 think inf cape return
原文地址:https://www.cnblogs.com/mo3408/p/14875911.html