加入收藏 | 设为首页 | 会员中心 | 我要投稿 安卓应用网 (https://www.0791zz.com/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 编程开发 > PHP > 正文

php 英文、数字验证码的完整代码

发布时间:2020-05-25 23:47:55 所属栏目:PHP 来源:互联网
导读:php 英文、数字验证码的完整代码

感兴趣的小伙伴,下面一起跟随脚本之家 jb51.cc的小编来看看吧。
经测试代码如下:


/**
 *  建立英文数字验证码
 *
 * @param 
 * @author 脚本之家 jb51.cc jb51.cc
 **/
 public function buildImageVerify(){
  $image = imagecreate($width,$height);
        $r = Array(225,255,223);
        $g = Array(225,236,237,255);
        $b = Array(225,166,125);
  $keys = mt_rand(0,3);
  $bg   = imagecolorallocate($image,$r[$keys],$g[$keys],$b[$keys]);//背景色
  $border = imagecolorallocate($image,100,100);
  $stringColor = imagecolorallocate($image,mt_rand(0,200),120),120));
  for ($i = 0; $i < 25; $i++) {
  
            imagesetpixel($image,$width),$height),$stringColor);
        }
  for($i=0;$i<4;$i++){
   $rand = dechex(mt_rand(0,15));
   $num.=$rand;
   imagestring($image,5,$i*10+5,mt_rand(1,8),$rand,$stringColor);
  }
  $_SESSION['verify'] = md5($num);
  $this->out($image,$type);
 }

(编辑:安卓应用网)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读