thinkphp-Verification Code

Source: Internet
Author: User

      

Public Function index () {
/*//Output Verification code
$Verify = new \think\verify ();
$Verify->entry ();
*/


/*//Multiple verification codes
Verification Code 1
$Verify = new \think\verify ();
$Verify->entry (1);
Verification Code 2
$Verify = new \think\verify ();
$Verify->entry (2);
*/

/*//Parameter settings used in two ways
Instantiating incoming parameters
$config = Array (
' FontSize ' = 30,//Captcha font size
' Length ' = 3,//Verify code digits
' Usenoise ' = false,//Turn off CAPTCHA clutter
);
$Verify = new \think\verify ($config);
$Verify->entry ();
*/
/*
Using dynamic settings
$Verify = new \think\verify ();
$Verify->fontsize = 30;
$Verify->length = 3;
$Verify->usenoise = false;
$Verify->entry ();
*/

/*
Verification Code Font
$Verify = new \think\verify ();
Captcha font using Thinkphp/library/think/verify/ttfs/5.ttf Fifth font (1~6)
$Verify->fontttf = ' 5.ttf ';
$Verify->entry ();
*/

/*//verification Code background image
$Verify = new \think\verify ();
Open the CAPTCHA background image function randomly use the picture below the THINKPHP/LIBRARY/THINK/VERIFY/BGS directory
$Verify->USEIMGBG = true;
$Verify->entry ();
*/

/*//Chinese Verification Code
$Verify = new \think\verify ();
CAPTCHA fonts use thinkphp/library/think/verify/ttfs/to automatically find the TTF for Chinese fonts
$Verify->usezh = true;
$Verify->entry ();
*/

/*/Cancel curve obfuscation
$Verify = new \think\verify ();
$Verify->usecurve = false;
$Verify->entry ();
*/

/*/Set Picture width height
$Verify = new \think\verify ();
$Verify->imagew = 200;
$Verify->imageh = 100;
$Verify->entry ();
*/
/*
Two types of specified CAPTCHA characters
Non-Chinese
$Verify = new \think\verify ();
Set the captcha character to be a pure number
$Verify->codeset = ' 0123456789 ';
$Verify->entry ();
*/
/*
Chinese
$Verify = new \think\verify ();
$Verify->usezh = true;
Setting CAPTCHA characters
$Verify->zhset = ' I'm going to do it when he's going to do it. Domestic one is a work on the annual order of the Ministry of the People can be out of the party into the discord has big this ';
$Verify->entry ();
*/

}


function in conjunction with functions for detection//(function functions)
Public Function test () {Verify that the input verification code is correct, $code the CAPTCHA string entered by the user
$code =i (' Get.code '); function Check_verify ($code, $id = ") {
Var_dump (Check_verify ($code)); $verify = new \think\verify ();
} return $verify->check ($code, $id);

}

thinkphp-Verification Code

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.