Home >php教程 >PHP开发 >ThinkPHP3.2.1 image verification code implementation method

ThinkPHP3.2.1 image verification code implementation method

高洛峰
高洛峰Original
2016-12-21 16:43:091199browse

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

ThinkPHP3.2.1 image verification code implementation method

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()"

ThinkPHP3.2.1 image verification code implementation method

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.

ThinkPHP3.2.1 image verification code implementation method

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!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn