Home  >  Article  >  Backend Development  >  Thinkphp 中 验证码 $_SESSION['verify'] 没有值怎么解决?

Thinkphp 中 验证码 $_SESSION['verify'] 没有值怎么解决?

WBOY
WBOYOriginal
2016-06-06 20:15:401315browse

求大神解答,谢谢谢谢

回复内容:

求大神解答,谢谢谢谢

你确定你设置来这个值吗?你可以var_dump($_SESSION)看下是否设置,请求验证码的接口确认session是否设置成功了,以及session_start()

你的session驱动用默认的还是用memcache?如果默认的检查是不是session没有开启,memcache检查memcache配置是不是有问题

如果你只是想验证一下验证码是否正确的话,是不用自己去获取的。直接:

<code>public function acheck($code){
        $Verify = new \Think\Verify();
        return $Verify->check($code);
    }</code>

把用户输入的验证码传给这个acheck()方法就可以了。

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