Home > Backend Development > PHP Tutorial > ThinkPHP学习(5)图片验证码

ThinkPHP学习(5)图片验证码

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
Release: 2016-06-13 11:56:58
Original
958 people have browsed it

ThinkPHP学习(五)图片验证码

今天用到图片验证码的功能,在网上找到ThinkPHP的以下代码:

	Public function verify(){		import('think.Image');		Image::buildImageVerify();	 }
Copy after login
添加到Controller中,通过地址“http://localhost/index.php/passport/index/verify”来访问,却提示以下错误:

Class 'Passport\Controller\Image' not found


我的ThinkPHP版本是:3.2.1,经过查看对应版本的文档“http://document.thinkphp.cn/manual_3_2.html#verify”,发现需要使用以下代码:

	Public function verify(){		$Verify = new \Think\Verify();		$Verify->entry();	 }
Copy after login
但刷新浏览之后又出错了“Call to undefined function Think\imagecreate()”


搜索之后发现是没有启用“extension=php_gd2.dll”扩展,在php.ini中去掉前边的分号; 再刷新浏览图片验证码就出来了。





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 Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template