The example in this article describes the implementation method of ThinkPHP3.2.1 image verification code. Share it with everyone for your reference, the details are as follows:
Today I used the image verification code function and found the following code of ThinkPHP on the Internet:
Public function verify(){ import('think.Image'); Image::buildImageVerify(); }
Add it to the Controller through the address "http://localhost/ index.php/passport/index/verify" to access, but the following error is prompted:
Class 'PassportControllerImage' not found
My ThinkPHP version is: 3.2.1, after checking the corresponding version of the document "http:/ /document.thinkphp.cn/manual_3_2.html#verify" and found that the following code needs to be used:
Public function verify(){ $Verify = new \Think\Verify(); $Verify->entry(); }
But after refreshing the browser, an error occurred again "Call to undefined function Thinkimagecreate()"
After searching It was found that the "extension=php_gd2.dll" extension was not enabled. Remove the semicolon in front of it in php.ini; refresh the browser image and the verification code will appear.
I hope this article will be helpful to everyone’s PHP program design based on the ThinkPHP framework.
For more articles related to ThinkPHP3.2.1 image verification code implementation methods, please pay attention to the PHP Chinese website!