TP validation rules Validate

use think\Validate;


    ]; public function




     

     

     


      addInfoData($member_id, $type, $money, $invoice_name, $invoice_tel, $email, $taxpayer_number, $id)
    {
        $data = [
            'type' => $type,
            'invoice_tel' => $invoice_tel,
            'email' => $email,
        ];
        $validate = new Validate($this->rule, $this->message);
        if (!$validate->check($data)) {
            return ['code' => 400, 'msg' => $validate->getError()];
        }
    }
}

 

Guess you like

Origin www.cnblogs.com/camg/p/11999978.html