Home > php教程 > php手册 > thinkphp验证码显示不出来的解决方法

thinkphp验证码显示不出来的解决方法

WBOY
Release: 2016-06-06 20:23:38
Original
1490 people have browsed it

这篇文章主要介绍了thinkphp验证码显示不出来的解决方法,需要的朋友可以参考下

php的配置文件php.ini,,搜索extension=php_gd2.dll,去掉前面的分号即可;

1.在模块类中增加一个 verify 方法来用于显示验证码

复制代码 代码如下:


Public function verify(){
    // 导入Image类库
    import("ORG.Util.Image");
    Image::buildImageVerify();
}

2.表单中使用验证码

复制代码 代码如下:



thinkphp验证码显示不出来的解决方法

3.验证码刷新

复制代码 代码如下:



4.验证码验证

复制代码 代码如下:


if($_SESSION['verify'] != md5($_POST['verify'])) {
    $this->error('验证码错误!');
}

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