THINKPHP5 do not use composer to develop picture verification code

Source: Internet
Author: User

Many friends may not be able to use composer, nothing, I was the first time the idea, it is better to directly put composer downloaded directly into the project, are equivalent, but I found that there are more than composer easier way, The code package for the next TP5 graphics verification code can be referenced in the Extend directory. Can Baidu search this bag, or if not find to go to my group next. 84451248

Put it down in the Extend directory, and then began to write code, the code is very few lines we here is the front and back end of the separation, but you do not separate and do not affect the use of my Code, which is the code

First don't forget to introduce the method in the head

Use Think\captcha\captcha;
And then there's the serious code.
1 //Generate verification Code2  Public functionindex ()3     {4 5Loader::import (' Captcha.src.Captcha ', Extend_path, '. class.php ');6         $captcha=NewCaptcha ();7         $captcha->fontsize = 25;8         $captcha->length = 3;9         $captcha->usenoise =false;Ten         return $captcha->entry (' AC '); One         //Print_r (Session (')); A  -  -     } the  - //Verify that the verification code is correct -      Public functionSave (Request$request) -     { +         //Verify that the verification code is correct -         $captcha 2=input (' Post.imgcode '); +Loader::import (' Captcha.src.Captcha ', Extend_path, '. class.php '); A         $captcha=NewCaptcha (); at         $result=$captcha->check ($captcha 2, ' AC '); -         if(!$result){ -             return $this->returnjson ('-1 ', ' mismatch '); -}Else{ -           return $this->returnjson (' 200 ', ' verified success '); - ; } in          -}

What's going on, it's not going to be okay, come find me

THINKPHP5 do not use composer to develop picture 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.