Home > php教程 > PHP开发 > body text

ThinkPHP3.2.1 image verification code implementation method

高洛峰
Release: 2016-12-21 16:43:09
Original
1126 people have browsed it

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();
}
Copy after login

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();
}
Copy after login

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!

Related labels:
source:php.cn
Statement of this Website
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
Popular Recommendations
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!