首页  >  问答  >  正文

验证码的代码在哪复制运行我打了代码大部分但是在最后也许是没打完运训出错未定义的方法

<?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;

}


}

?>


。水波不清。水波不清1958 天前1131

全部回复(0)我来回复

暂无回复
  • 取消回复