Create a function. php In the Home-Common folder to save the public function? Phpfunctioncheck_verify ($ code, $ id1) {$ verifynewThinkVerify (); return $ verify-check ($ code, $ id );} this function is used to test the verification code and create a PublicContrroler in the Home-Contrroler folder.
Create a function. php In the Home-Common folder to save the public function? Php function check_verify ($ code, $ id = 1) {$ verify = new \ Think \ Verify (); return $ verify-check ($ code, $ id );} this function is used to test the verification code and create a PublicContrroler in the Home-Contrroler folder.
Create a function. php file in the Home-> Common folder to save the public functions.
Function check_verify ($ code, $ id = 1 ){
$ Verify = new \ Think \ Verify ();
Return $ verify-> check ($ code, $ id );
}
This function is used to verify the verification code.
In the Home-> Contrroler folder, create a PublicContrroler. class. php for public controllers. All other controllers are integrated with the following code to generate verification codes.
Public function verify ($ id = 1 ){
$ Config = ??? Array (
'Fontsize '??? ==> ??? 18 ,??? // Font size of the Verification Code
'Length '????? ==> ??? 4 ,???? // Number of digits of the Verification Code
'Imageh '????? ==> ??? 34, // disable the verification code Miscellaneous
'Usenoise '??? ==> ??? False, // disable the verification code Miscellaneous
'Usecurve '??? ==> ??? False,
);
$ Verify = new \ Think \ Verify ($ config );
$ Verify-> entry ($ id );
}
Call Verification Code
If a page contains multiple verification codes, you can add an ID parameter.
Verification Code
If (! Check_verify ($ verify1, 1 )){
$ This-> error ('verification code entered incorrectly! ');
}
The second parameter is id.
Click to reload the verification code based on jquery