PHP生成图形化验证码

参考

PHP 代码


html中调用

![](/images/checkcode.php)

js中实现点击切换验证码

function changing(){
    document.getElementById('checkpic').src="/images/checkcode.php?"+Math.random();
} 

php中进行校验(从session中取验证码显示的数字)

$checkcode = $_SESSION["verification"];

if ($data['checkcode'] != $checkcode) {
            throw new Exception("验证码错误", 1003);
        }

一个敲代码,爱分享的人,我在这里!

PHP生成图形化验证码_第1张图片
来玩啊

你可能感兴趣的:(PHP生成图形化验证码)