Action里面如何取得验证码的值?

class LoggingController extends CController

{

/**


 * Declares class-based actions.


 */


public function actions()


{


        return array(


	// captcha action renders the CAPTCHA image


	'captcha'=>array(


		'class'=>'CCaptchaAction',


		'backColor'=>0xEBF4FB,


	),


        );


}

}

Action代码如上

看了下文档,没有取 图片验证码 字符串的 方法。请问如何取 验证码的 值。

你为什么要取验证码的值呢?

如果确实需要,你可以通过下面的方式获得:

$this->createAction(‘captcha’)->getVerifyCode()

谢谢,登陆校验的时候需要

你得看看例子了,登录 的时候在model里就做掉了。。不需求这样写的


public function rules()

	{

		return array(

			// username and password are required 

			array('username', 'required','message' => Yii::t('admin', 'username error')),

			array('password', 'required','message' => Yii::t('admin', 'password error')), 

			array('username', 'length', 'min'=>3, 'max'=>16),		

			// password needs to be authenticated

			array('password', 'authenticate'),

			array('verifyCode', 'captcha', 'allowEmpty'=>!extension_loaded('gd')),

		);

	}

你说的应该是


	array('verifyCode', 'captcha', 'allowEmpty'=>!extension_loaded('gd')),