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