[PHP GD库]⑥--验证码函数封装

verify.func.php

 0) {
        for ($i = 1; $i <= $pixel; $i++) {
            imagesetpixel($image, mt_rand(0, $width), mt_rand(0, $height), getRandColor($image));
        }
    }
    if ($line > 0) {
        for ($i = 1; $i <= $line; $i++) {
            imageline($image, mt_rand(0, $width), mt_rand(0, $height), mt_rand(0, $width), mt_rand(0, $height), getRandColor($image));
        }
    }
    if ($arc > 0) {
        for ($i = 1; $i <= $arc; $i++) {
            imagearc($image, mt_rand(0, $width / 2), mt_rand(0, $height / 2), mt_rand(0, $width), mt_rand(0, $height), mt_rand(0, 360), mt_rand(0, 360), getRandColor($image));
        }
    }


    header('content-type:image/png');
    imagepng($image);
    imagedestroy($image);

}

getVerify('fonts/simsunb.ttf', 3);

?>

reg.php





    
    注册页面


IMOOC注册页面

用户名
密码
验证码 ![](verify.func.php)看不清,换一个

doAction.php

";
var_dump($_SESSION);
?>
[PHP GD库]⑥--验证码函数封装_第1张图片
Paste_Image.png
[PHP GD库]⑥--验证码函数封装_第2张图片
Paste_Image.png

你可能感兴趣的:([PHP GD库]⑥--验证码函数封装)