Maison >développement back-end >tutoriel php > 请教如何改验证里面字的大小
请问怎么改验证里面字的大小?
http://pan.baidu.com/share/link?shareid=343815&uk=1865794164 不知道怎么回事上传不了图片,我把图片放百度网盘了。
如上图,请问怎么改验证里面字的大小?
代码如下:
<?php<br /> <br /> session_start();<br /> //session_register('SafeCode');<br /> $type = 'gif';<br /> $width= 92;<br /> $height= 30;<br /> header("Content-type: image/".$type);<br /> srand((double)microtime()*1000000);<br /> $randval = randStr(4,"");<br /> if($type!='gif'&&function_exists('imagecreatetruecolor')){<br /> $im = @imagecreatetruecolor($width,$height);<br /> }else{<br /> $im = @imagecreate($width,$height);<br /> }<br /> $r = Array(225,211,255,223);<br /> $g = Array(225,236,237,215);<br /> $b = Array(225,236,166,125);<br /> $key = rand(0,3);<br /> $backColor = ImageColorAllocate($im,$r[$key],$g[$key],$b[$key]);<br /> $borderColor = ImageColorAllocate($im,0,0,0);<br /> $pointColor = ImageColorAllocate($im,255,170,255);<br /> @imagefilledrectangle($im,0,0,$width -1,$height -1,$backColor);<br /> @imagerectangle($im,0,0,$width-1,$height-1,"");<br /> $stringColor = ImageColorAllocate($im,555,51,153);<br /> for($i=0;$i<=100;$i++){<br /> $pointX = rand(2,$width-2);<br /> $pointY = rand(2,$height-2);<br /> @imagesetpixel($im,$pointX,$pointY,$pointColor);<br /> }<br /> @imagestring($im,10,10,2,$randval,$stringColor);<br /> $ImageFun='Image'.$type;<br /> $ImageFun($im);<br /> @ImageDestroy($im);<br /> $_SESSION['validationcode'] = $randval;<br /> function randStr($len=6,$format='NUMBER') {<br /> switch($format) {<br /> case 'ALL':<br /> $chars='0123456789';break;<br /> case 'CHAR':<br /> $chars='';break;<br /> case 'NUMBER':<br /> $chars='0123456789';break;<br /> default :<br /> $chars='0123456789';<br /> break;<br /> }<br /> $string="";<br /> while(strlen($string)<$len)<br /> $string.=substr($chars,(mt_rand()%strlen($chars)),1);<br /> return $string;<br /> }<br /> ;echo ' ';<br /> ?>