| 1234567891011121314151617181920212223242526272829 |
- <?php
- namespace app\validate;
- use app\exception\BaseException;
- use \think\validate;
- class BaseValidate extends Validate
- {
- /**
- * @return bool
- * @throws BaseException
- * TODO: 全局验证处理 前台传过来的值必须通过HttpRequestCheck方法进行验证
- */
- public function HttpRequestCheck()
- {
- # Request实例化获取不到值
- $params = \think\facade\Request::instance()->param();
- if (!$this->check($params)) {
- throw new BaseException($this->message = $this->getError());
- }
- return true;
- }
- }
|