<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>

                ??一站式輕松地調用各大LLM模型接口,支持GPT4、智譜、豆包、星火、月之暗面及文生圖、文生視頻 廣告
                1.定義公共驗證類BaseValidate ~~~ <?php namespace app\api\validate; use think\Exception; use think\Request; use think\Validate; class BaseValidate extends Validate { public function goCheck() { // 獲取http傳入的參數 // 對這些參數做檢驗 $request = Request::instance(); $params = $request->param(); $result = $this->check($params); if(!$result){ $error = $this->error; throw new Exception($error); } else{ return true; } } } ~~~ 2.把IDMustBePostiveInt 繼承公共類 ~~~ <?php namespace app\api\validate; use think\Validate; class IDMustBePostiveInt extends BaseValidate { protected $rule = [ 'id' => 'require|isPositiveInteger' ]; protected function isPositiveInteger($value, $rule = '', $data = '', $field = '') { if (is_numeric($value) && is_int($value + 0) && ($value + 0) > 0) { return true; } else{ return $field.'必須是正整數'; } } } ~~~ 3.banner.php代碼 ~~~ <?php namespace app\api\controller\v1; use app\api\validate\IDMustBePostiveInt; class Banner{ //獲取指定id的banner信息 public function getBanner($id) { (new IDMustBePostiveInt())->goCheck(); echo "123"; } } ~~~ 結果: ![](https://box.kancloud.cn/c25587d069a7ec0059643e71fe94a8b9_1310x840.png)
                  <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>

                              哎呀哎呀视频在线观看