zoukankan      html  css  js  c++  java
  • ThinkPHP5.0框架开发--第10章 TP5.0验证器

    ThinkPHP5.0框架开发--第10章 TP5.0验证器

    第10章 TP5.0验证器

    =======================================

    今日学习

    1、验证器

            

             1) 控制器中使用验证器

                          // 实例化验证器类

                          $validate=new Validate(

                                    [

                                              "username"=>"require|length:6,12",

                                              "password"=>"require|confirm:repassword"

                                    ],

                                    [

                                              "username.require"=>'用户名不存在',

                                              "username.length"=>'用户名长度不满足',

                                              "password.require"=>'密码不存在',

                                              "password.confirm"=>'两次密码不一致',

                                    ]

                                );

                          // 接收用户提交的数据

                          $data=input("post.");

                          // 进行验证

                          if ($validate->check($data)) {

                                   

                          }else{

                                    dump($validate->getError());

                          }

  • 相关阅读:
    《当大数据遇见网络:大数据与SDN》
    Internet History, Technology and Security (Week 9)
    Internet History, Technology and Security (Week 8)
    Internet History, Technology and Security (Week 7)
    北京讲座所感---6.14~6.15
    Internet History, Technology and Security (Week 6)
    Internet History, Technology and Security (Week 4)
    Internet History, Technology and Security (Week 3)
    Alpha 事后诸葛亮(团队)
    Alpha答辩总结
  • 原文地址:https://www.cnblogs.com/Renyi-Fan/p/8598685.html
Copyright © 2011-2022 走看看