Why is the verification code always incorrect in the yii Framework my view page?
My controller
The formmodel page
I tried a lot of writing methods. do you want to verify it? if you're right, he just told me that the verification code is incorrect. I really don't know what to do. please help me ~~~
Reply to discussion (solution)
Haha, I solved it myself !! I added a line to the framework verification code class before the public function run () is incorrect ()
{
// $ This-> fixedVerifyCode = substr (mt_rand (),); // optimize the verification code
If (isset ($ _ GET [self: REFRESH_GET_VAR]) // AJAX request for regenerating code
{
$ Code = $ this-> getVerifyCode (true );
Echo CJSON: encode (array (
'Hash1' => $ this-> generateValidationHash ($ code ),
'Hash2' => $ this-> generateValidationHash (strtolower ($ code )),
// We add a random 'V' parameter so that FireFox can refresh the image
// When src attribute of image tag is changed
'URL' => $ this-> getController ()-> createUrl ($ this-> getId (), array ('V' => uniqid ())),
));
}
Else
$ This-> renderImage ($ this-> getVerifyCode ());
Yii: app ()-> end ();
}
After adding that line of optimization verification code, the comment is correct.