public function checkLogin (Request $request)
{
## $status = 0 ; data = $request->param(); $result = validate(UserValidate::class)->check($data);##///////測試中發現欄位驗證不通過 就不往下執行了
if($result){
$result = '驗證成功';
## $result = '驗證成功';## 1 $status = 1 ;
}else{
》 return ['status'=>$status, 'message'=>$result, 'data'=>$data];
}
#
<?phpnamespace app\validate;use think\Validate;class User extends Validate{
protected $rule = [
'name|使用者名稱' 使用者名稱' ,
'password|密碼' => 'require',
'verify|驗證碼' => 'require|captcha', ) $
##S; message = [ 'name|使用者名稱.require' => '名稱必須填入', 'password#.require' =>'verify.require' => '驗證碼必須填寫',
'verify.captcha' =&
=========================================== =======================<?phpnamespace app\facade; use think\Facade;/****/class User extends Facade{ protected static function getFacadeClass() { # return 'app\validate\User'; }}======================== ====================================== public function checkLogin (Request $ request) { # $status = 0 ; 〉 $status = 0 ; # $status = 0 ; p##N $$$res = new UserValidate; // $result = $validate->check($data); if(UserFacade::ch遠($data)){ ## $status = 1 ; }else{ return ['status'=>$status, 'message'=>$result, 'data'=>$data]; }} 自訂的message 沒有顯示出來