皎然
- 皎然 2017-09-16 已签到连续签到6天,获得了20个金钱
- 皎然 发表了说说验证码问题终于搞定了,发个红包
- 皎然 2017-09-15 已签到连续签到5天,获得了20个金钱
- 皎然 发表了说说我真是路痴
- 皎然 2017-09-14 已签到连续签到4天,获得了20个金钱
- 皎然 发表了说说加班吃炸酱品,打卡
- 皎然 2017-09-13 已签到连续签到3天,获得了15个金钱
public function prevCaptcha($attribute, $params) { $captcha = $this->createCaptchaAction(); $value = $this->vcode; $valid = !is_array($value) && $captcha->validate($value, $this->caseSensitive); if (!$valid) { $this->addError($attribute, ErrorCode::ERROR_VCODE_NOT_MATCH); } } public function createCaptchaAction() { $ca = Yii::$app->createController($this->captchaAction); return $this->captchaAction; if ($ca !== false) { /* @var $controller \yii\base\Controller */ list($controller, $actionID) = $ca; $action = $controller->createAction($actionID); $action->regenerateAfterValidation = false; if ($action !== null) { return $action; } } throw new InvalidConfigException('Invalid CAPTCHA action ID: ' . $this->captchaAction); }
上面是重写的验证方法,总在下面这一步报错,有什么解决办法吗
$ca = Yii::$app->createController($this->captchaAction);
$this->captchaAction = 'api/article/captcha';在$ca = Yii::$app->createController($this->captchaAction);创建控制器的时候总返回false
- 皎然 2017-09-12 已签到连续签到2天,获得了10个金钱
- 皎然 赞了回复
public function prevCaptcha($attribute, $params) { $captcha = $this->createCaptchaAction(); $value = $this->vcode; $valid = !is_array($value) && $captcha->validate($value, $this->caseSensitive); if (!$valid) { $this->addError($attribute, ErrorCode::ERROR_VCODE_NOT_MATCH); } } public function createCaptchaAction() { $ca = Yii::$app->createController($this->captchaAction); return $this->captchaAction; if ($ca !== false) { /* @var $controller \yii\base\Controller */ list($controller, $actionID) = $ca; $action = $controller->createAction($actionID); $action->regenerateAfterValidation = false; if ($action !== null) { return $action; } } throw new InvalidConfigException('Invalid CAPTCHA action ID: ' . $this->captchaAction); }
上面是重写的验证方法,总在下面这一步报错,有什么解决办法吗
$ca = Yii::$app->createController($this->captchaAction);
$this->captchaAction = 'api/article/captcha';