TP6 封装三要素 成功返回 错误返回

阅读 102

2022-02-19

class codeDate
{
// 正确返回三要素
    public function correct($code,$msg,$data=[''])
    {
        return json(['code'=>$code,'msg'=>$msg,'data'=>$data]);
    }
//    错误返回三要素
    public function error($code,$msg,$data=[''])
    {
        return json(['code'=>$code,'msg'=>$msg,'data'=>$data]);
    }

精彩评论(0)

0 0 举报