This article describes how to use php to implement a Chinese Verification Code. The Code is simple and can be directly used.
This article describes how to use php to implement a Chinese Verification Code. The Code is simple and can be directly used.
The Code is as follows:
$ Text = 'one of them is not good, even though there is no day to start sending things only when you want to see the text without opening hands ten with the main line side, as shown in the previous article, the first face of the public with three the two elders who have been driven by the old followers are now divided into the outside, but they are more and more willing to implement this method back to the two reasons. to wait for a few of the industry's most new things to play the role because the re-electric fourth door Xiangxiang Dongzheng Haikou enable to teach the west and then to listen to the world to believe that the north less customs and the addition of the by but on behalf of the army production in xianshan wutaishui Wanshi eye and body in other places the total number of teachers and books than the living staff nine smile eye Hua Bao immediately killed Zhang active hard work piece security watch original car White should road stage called dead often mention sense Jin he is more anti-integrated and used as a system engineer or Si Li by Guang wangguo's pro community and today's Beijing affairs system, each of them goes to the Qing Dynasty, as the audience remembers and works together to pick it up with Xu bate. please make love to make the general colors of the straight-forward server Mao Lin question ';
$ Im = imagecreatetruecolor (100,45 );
$ Font = './msyhbd. ttf ';
$ Len = mb_strlen ($ text, 'utf-8 ');
$ Gray = imagecolorallocate ($ im, 200,200,200 );
Imagefill ($ im, 0, 0, $ gray );
For ($ I = 0, $ x = 0; $ I <4; $ 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 (225), $ color, $ font, $ tmp );
}
Header ('content-type: image/png ');
Imagepng ($ im );
Imagedestroy ($ im );
?>
,