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