For the security of the site, the use of verification code technology is more common, today according to the thinkphp3.2 full development manual example (address http://document.thinkphp.cn/manual_3_2.html#verify), always error , the verification code cannot be displayed because the GD library was not opened in the php.ini file.
Just remove the Extension=php_gd2.dll comment from the configuration file php.ini (Php_gd2.dll GD library image function Library GD2).
Generate Verification Code
Public function code () { $Verifynew Verify (); $Verify->fontsize =; $Verify->length = 4; $Verify false ; $Verify-entry ();}
Login Check
functionDo_login () {//get the user name and password, and so on. And in the database, there is a user allowed to log on otherwise output error page $username=$_post[' username ']; $password=$_post[' Password ']; $code=$_post[' Code ']; $verify=New\think\verify (); $r=$verify->check ($code, ‘‘); if(!$r){ $this->error (' Verification code Error! ‘); } $m=m (' User '); $where[' username ']=$username; $where[' Password ']=$password; $i=$m->where ($where),Count(); if($i>0){ $this->redirect (' User/index '); }Else{ $this->error (' The user does not exist '); } }