<ruby id="bdb3f"></ruby>

    <p id="bdb3f"><cite id="bdb3f"></cite></p>

      <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
        <p id="bdb3f"><cite id="bdb3f"></cite></p>

          <pre id="bdb3f"></pre>
          <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

          <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
          <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

          <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                <ruby id="bdb3f"></ruby>

                ThinkChat2.0新版上線,更智能更精彩,支持會話、畫圖、視頻、閱讀、搜索等,送10W Token,即刻開啟你的AI之旅 廣告
                如果你需要在控制器中進行驗證,并且繼承了`\think\Controller`的話,可以調用控制器類提供的`validate`方法進行驗證,如下: ~~~ $result = $this->validate( [ 'name' => 'thinkphp', 'email' => 'thinkphp@qq.com', ], [ 'name' => 'require|max:25', 'email' => 'email', ]); if(true !== $result){ // 驗證失敗 輸出錯誤信息 dump($result); } ~~~ 如果定義了驗證器類的話,例如: ~~~ namespace app\index\validate; use think\Validate; class User extends Validate { protected $rule = [ 'name' => 'require|max:25', 'email' => 'email', ]; protected $message = [ 'name.require' => '用戶名必須', 'email' => '郵箱格式錯誤', ]; protected $scene = [ 'add' => ['name','email'], 'edit' => ['email'], ]; } ~~~ 控制器中的驗證代碼可以簡化為: ~~~ $result = $this->validate($data,'User'); if(true !== $result){ // 驗證失敗 輸出錯誤信息 dump($result); } ~~~ 如果要使用場景,可以使用: ~~~ $result = $this->validate($data,'User.edit'); if(true !== $result){ // 驗證失敗 輸出錯誤信息 dump($result); } ~~~ 在validate方法中還支持做一些前置的操作回調,使用方式如下: ~~~ $result = $this->validate($data,'User.edit',[],[$this,'some']); if(true !== $result){ // 驗證失敗 輸出錯誤信息 dump($result); } ~~~
                  <ruby id="bdb3f"></ruby>

                  <p id="bdb3f"><cite id="bdb3f"></cite></p>

                    <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
                      <p id="bdb3f"><cite id="bdb3f"></cite></p>

                        <pre id="bdb3f"></pre>
                        <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

                        <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
                        <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

                        <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                              <ruby id="bdb3f"></ruby>

                              哎呀哎呀视频在线观看