PHP Chinese Verification Code implementation sample sharing

Source: Internet
Author: User

This article mainly introduces the use of PHP to implement Chinese verification code, simple code, you can directly use

The code is as follows: <?php $text = ' One is not able to be good all of the day, but also to do only when you want to see the text without opening the hands of the ten with the main line of the same as before, see through the head and three have been old from moving two long to know the people like the present points will be outside but the body and Gao I into the method of this real back to two of the beauty of the sound of the whole work of their own words to the Ministry of the word to the Department of the name of the female ask the machine and so on a few very industry most New Shi hit the position due to the power of the four door Zedong Haikou to teach West again ping true to listen to the north of the gas and the increase by the Army produced in the first mountain five too water million eye elsewhere always only field teacher book than the nine of the life of the staff of the smile, the report immediately lives difficult God several pieces of an original car white to the road is called death often feel gold what more to do with the Bensley or the light Wang Guo the pro-boundary and the current Beijing business system to the clearing of the Taiwan Elephant and the edge of the common wind War dry connect it Xu Bate Vision straight suit Mao Lin problem built South degree  Please make love to the color word.  $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 < 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 (21,25), $color, $font, $tmp);  Header (' content-type:image/png ');  Imagepng ($im);  Imagedestroy ($im); ?>
Related Article

E-Commerce Solutions

Leverage the same tools powering the Alibaba Ecosystem

Learn more >

Apsara Conference 2019

The Rise of Data Intelligence, September 25th - 27th, Hangzhou, China

Learn more >

Alibaba Cloud Free Trial

Learn and experience the power of Alibaba Cloud with a free trial worth $300-1200 USD

Learn more >

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: and provide relevant evidence. A staff member will contact you within 5 working days.