登录  /  注册
验证码的代码在哪复制运行我打了代码大部分但是在最后也许是没打完运训出错未定义的方法
。水波不清
。水波不清 2019-06-09 19:53:43
[PHP讨论组]

<?php

check_codo();

//$img = imagecreate($width,$height);//创建画布并且传入两个变量宽高

function check_codo($width = 100,$height = 50,$num = 4, $type = 'jpeg'){

$img = imagecreate($width, $height);

$string = '';

for ($i = 0;$i < $num;$i++) {

$rand = mt_rand(0,2);

switch ($rand) {

case 0:

$ascll = mt_rand(48,57);//0-9

break;

case 1:

$ascll = mt_rand(65,90);//A-Z

break;

case 2:

$ascll = mt_rand(97,122);//a-z

break;

}

$string = sprintf('$c',$ascll);

}

//背景颜色

imagefilledrectangle($img, 0, 0, $width, $height, randBg($img));

//干扰元素

for ($i=0; $i < 50; $i++) {

imagesetpixel($img, mt_rand(0,$width),mt_rand(0,$height),randPix($img)); 

# code...

}

//写字

for ($i=0; $i < $num; $i++) { 

$x = floor($width / $num) * $i+2;

}


}

?>


。水波不清
。水波不清

全部回复(0)
热门教程
更多>
最新下载
更多>
网站特效
网站源码
网站素材
前端模板
关于我们 免责申明 意见反馈 讲师合作 广告合作 最新更新
php中文网:公益在线php培训,帮助PHP学习者快速成长!
关注服务号 技术交流群
PHP中文网订阅号
每天精选资源文章推送
PHP中文网APP
随时随地碎片化学习
PHP中文网抖音号
发现有趣的

Copyright 2014-2024 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号