简单中文验证码
-
$text = '的一是不了人我在有他这中大来上国个到说们为子和你地出道也时年得就那要下以生会自着去之过家学对可她里后小么心多天而能好都然没日于起还发成事只作当想看文无开手十用主行方又如前所本见经头面公同三已老从动两长知民样现分将外但身些与高意进把法此实回二理美点月明其种声全工己话儿者向情部正名定女问力机给等几很业最间新什打便位因重被走电四第门相次东政海口使教西再平真听世气信北少关并内加化由却代军产入先山五太水万市眼体别处总才场师书比住员九笑性通目华报立马命张活难神数件安表原车白应路期叫死常提感金何更反合放做系计或司利受光王果亲界及今京务制解各任至清物台象记边共风战干接它许八特觉望直服毛林题建南度统色字请交爱让';
- $im = imagecreatetruecolor(100,45);
- $font = './msyhbd.ttf';
- $len = mb_strlen($text,'UTF-8');
- $grey = imagecolorallocate($im,200,200,200);
- imagefill($im,0,0,$grey);
- for($i = 0,$x = 0 ;$i $color = imagecolorallocate($im,mt_rand(0,190),mt_rand(0,190),mt_rand(0,190));
- $x += $i*10 + mt_rand(1,5);
- $tmp = mb_substr($text,mt_rand(0,$len),1,'UTF-8');
- imagettftext($im,mt_rand(10,16),mt_rand(-15,15),$x,mt_rand(21,25),$color,$font,$tmp);
- }
- header('content-type:image/png');
- imagepng($im);
- imagedestroy($im);
- ?>
复制代码
|