/** * 验证码的Action. */ public function actionVerify() { $length = Yii::app()->request->getQuery('length'); $image_width = Yii::app()->request->getQuery('image_width'); $image_height = Yii::app()->request->getQuery('image_height'); $verifyImage = new VerifyImage($length, $image_width, $image_height); $verifyImage->createImage(); }
/** * 检查验证码 */ public function checkVerify() { if (!VerifyImage::checkVerify($this->verify)) { $this->addError('verify', '验证码错误'); } }