Php Chinese verification code implementation example sharing

Source: Internet
Author: User
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 );
?>

,

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.