Php Chinese verification code production tutorial

Source: Internet
Author: User
PHP Chinese verification code, PHP communication, PHP blog, PHP how to generate a Chinese verification code, PHP how to generate a Chinese verification code tutorial

1. First, create a verification code form.

Enter the verification code:

Click the verification code image to change the verification code.

 

2. create a new file named vimage. php. the code is as follows:

Header ("Content-type: image/PNG ");
$ Ch_str = "first, when there is a conflict with everyone, the main person will use work hours for them. in this case, when I arrive at the country, he will do the work. for the lower-level students, he will create a ministry. the outsourcers can go to the same industry to say that they are desperate, and after many sub-accounts, they can go from social networks and small hosts, and also rely on their own power lines. the high volume of electricity, the long party has to go through the real-time and deep-seated method. starting from politics, 3, 3, and 10, without agricultural servers, etc. The Road Map of anti-physical combat makes a new discussion of things starting from when two or more Tianzi event teams are ready for approval. change off-point education focus on its thinking and in-room because of the day-benefit of the parts by the pressure staff gas industry on behalf of the whole group number fruit period guide each base or month Mao ran asked than exhibition that it did not look at the most out zhiti five solution series Lin's Rice Group head meaning only four horses recognize the article pass, but the more grams and the public hole leading to access the seat condition runner and fly the crude oil to set up the question quality refers to the establishment of the district test the active crowd is very taught here. Shi Qiang is very rare in the Earth has been rooted in a total of direct mission type conversion don't make cut nine you take the West holding the total material re-election Zhi Guan tune seven What Mountain Cheng Baibao more see must be true the mobile phone change management department of the Baozhong committee has already completed the maintenance and identification of the disease as the first example of the old-light-dedicated six-type Fu 'an belt. after each dongzeng, the wind will return to the south-Guang Lao Lun kebei district to build a car for the festival. by the whole row type Set No. column temperature installation that is, the fine axis of the study of the monochrome, fast anti-DDoS Shi Lashi set Dalon field weaving calendar flower by seeking to pass the mouth breaking condition mining fine gold industry products judgment parameter layer end edge cleaning to the ten indeed research book-like factory should be from the eyes of the sea to pay the right and the children's Qingcai certificate lower beyond the eight trial rules near the note to run the bumen iron need to go to the county soldiers fixed removal like tooth wins fine yingji Baige effect push blank configuration knife leaf rate description this election Yangde phone query difference half enemy starting film Shi Xiang received Wasu standby name Red continued average drug Mark difficult to store tester body tight liquid School zun Jin Jiao Dimensionality Reduction Board Xu broke the technology to eliminate the bottom bed Field trend sense to Shen benhe village structure photo not engaged in sub-grinding fire section calculation according to the value of the United States Huang Yi Biao server early shift mic cutting letter sound the attacker Zhang Miwei Hou Cao he shufa following the right city strict diameter screw inspection left Page anti Su Xian bitter English fast known bad shipping about BA Cai province Black wu Pei-he-di-Zhi-Jing Zhu-Sheng-Wang's eye. she grasped the sub-Miscellaneous containing seedlings and talked about the food sources. the old ones caused by acid, but there were plenty of short strokes. bo Cheng powder practices Fu Yu with the test engraved rely on enough husband lost bag promote branch bureau bacteria Rod week Yan instructor Qu Chun Yuan ultra negative sand seal for too much mold poor reduction Yang Jiang Mu Yan qiuchao medical school play an excellent proportion of the dead poison ring Wei season training control exciting look called cloud mutual split grain mother train plug steel top policy Double Stay mistaken Foundation suck resistance so inch shield late silk female welding power plants were cold, bullet, and wrong, scattered businesses, visual arts, destroyed versions, strong room, light blood, times, lack of pump, detection, rich city, Chong, spray, soil, simple, no column, Li wangpan, magnetic Xiong, like sleepy Yi Zhou, out of delivery nuo side run cover swing from touch xingsong to get xingdu official mixed Ji according to not burst frame wide winter seal wet partial grain eat hold valve mine village responsibility cooked stable hard price nuduo Qijia pre post evaluation reading back co-loss cotton invasion ash although the spear thick Luo mud open the egg box ops oxygen love stop once dissolved camp final Gang Meng Qian to do Russia to shrink sand back Chen Fen mechanical load cell young which Peel force spin into slot inverted hold bear still Ah fresh it card rough medium drill by weak feet afraid of salt at the end of Yin Feng printing bee rush take expansion hurt flying Dew nuclear edge game vibration operation Yang Wu the domain is very Xunhui, and it is free of paper night Township. Jiu Lishi cylinder folder Nian Lan yinggou B? Ru kill steam phosphorus tooth bud Yong WA oblique irrigation ou Xian shun pig foreign rot please pass the department of dangerous pulse should laugh if tail bunch of strong and violent enterprises food Sui Chu Han more green drag cattle copy dyeing autumn times forging Yu Xia health Tip colony Jing Fei Zhou visits blow Rong copper along for rolling passengers call drought Wuzhi braocmeasures pass Tibet dare to make gap shell sulfur coal Yingzhu stick probe thin ten good fortune longitudinal selection ceremony May fu residual Lei Yan smoke sentence pure gradual ploughing run ze slow planting Lu Chifan environment tide off cone Xi Chi defeat ship fake Bright said togizhe Huai cut delivery Jin financial instrument Shen likes, moles, zombies, and zombies handle debate Zhu gu sell chaos virtual bridge OBO rush way of the amount of the Wall network cut Wild left quiet seeking to get hanging class town Sheng resistance jiadaojie Fu Qing together around the Moo busy dance encounter cable gu Jiao, goat, Lake, DingTalk, Renyin, broken, stretched out, light, escape, Pan death, answer, Yong frequency, Huang Liu, ha, uncover ganuo, summary, Xianqiang Island, attacked, flood, Xie, gun, spot, understanding, spirit, egg, and children, milk releasing jutu private silver yijingtan tired Yun mold Dulle bending performance recruit Shao Hu call pain peak zero Chai spring Wu jump jushang Ding Qin slightly chasing Liang discount alkali Shugang dig blade drama heap hehe chest Heng Qin film article published in the case of slow and convex active cut Sichuan snow chain fishing face households Luo Shu Bo Meng buy Yang zongjiao Saqi filter silica carbon shares sitting steam condensate actually trapped gun Li save the dark hole criminal cylinder you song arc burst paradox Tu flavor Jin arm barrier Brown Lu Jian Zun Bean pulling Mo against Sanpo sewing police pick dirty ice Cambodia mouth what Rice plastic sent Zhao shout mat Kang compliance mu was Banyuan cavity order Xiangdi House Minhui forgot clothing Sun Ling lie Hugh borrow Dan du ear planing tiger pen thin Kun Langsa tea drop showner cave covered Lun Niang tons of dipped sleeves pearl female Mazi Opera Tower hammer Zhen-old appearance clean section prison Feng suspect PA flash Po fierce v brush malicious and disaster-stricken Joe Tang leak smell Shen Rong chlorine dry stem man where grab like pulp next bo Yizhong sang Meng Yu Fen Yao Yu Wu Zhi Dan Yun rebellion animal capture touch rust sweep Bibao core Ye Jian secret Jing Jiang calcium shoulder Teng dry throwing rail Hall mix dad follow temptation wish liken wine rope poor pond dry bubble bag long feed aluminum soft canal used trade dung integrated wall tends his session of ink congestion Qi reverse unload air fog crown C Street laibei spoke sausage Fu Jixian ruifan squashed seconds to suspend mrotten sugar shengwa Tao word late silkworm hundred million moment ";
// The above Chinese character UTF-8 encoding is 3 bytes
$ Str = array ();
For ($ I = 0; $ I {
$ Str [] = $ ch_str [$ I]. $ ch_str [$ I + 1]. $ ch_str [$ I + 2];
}
// The length and height of the image
$ Image_x = 200;
$ Image_y = 100;
$ Im = imagecreate ($ image_x, $ image_y );
// The background color of the image is white.
$ Bkg = ImageColorAllocate ($ im, 255,255,255 );
// Display the font style. put the file in the corresponding directory. if you do not have any file, find one in the font file of window.
$ Fnt = "STXINGKA. TTF ";
// Assign some color to the image
$ White = ImageColorAllocate ($ im, 234,185, 95 );
// Draw an elliptical arc on the image and specify the coordinate point
Imagearc ($ im, 150, 8, 20, 20, 75,170, $ white );
Imagearc ($ im, 180, 75,175, 30, $ white );
// Draw a line segment on the image and specify the coordinate point
Imageline ($ im, 20, 20, 180,30, $ white );
Imageline ($ im, 20, 18, 170,50, $ white );
Imageline ($ im, 25, 50, 80, 50, $ white );
// Number of random points
$ Noise_num = 3000;
$ Line_num = 80;
// Color of various chaotic characters
$ Rectangle_color = imagecolorallocate ($ im, 0xAA, 0xAA, 0xAA );
$ Noise_color = imagecolorallocate ($ im, 0x00,0x00,0x00 );
$ Font_color = imagecolorallocate ($ im, 0x00,0x00,0x00 );
For ($ I = 0; $ I <$ noise_num; $ I ++)
{
// Draw a single pixel on a coordinate point, which is defined above and is black.
Imagesetpixel ($ im, mt_rand (0, $ image_x), mt_rand (0, $ image_y), $ noise_color );
}

For ($ I = 0; $ I <$ line_num; $ I ++)
{
$ Line_color = imagecolorallocate ($ im, mt_rand (0,255), mt_rand (0,255), mt_rand (0,255 ));
// Draw a line between two coordinate points, and the color is defined above
Imageline ($ im, mt_rand (0, $ image_x), mt_rand (0, $ image_y), mt_rand (0, $ image_x), mt_rand (0, $ image_y ), $ line_color );
}
$ Randnum = rand (0, count ($ str)-4 );
// The value is an even number.
If ($ randnum % 2)
{
$ Randnum + = 1;
}
$ Str1 = $ str [$ randnum]. $ str [$ randnum + 1]. $ str [$ randnum + 2]. $ str [$ randnum + 3];
For ($ I = 0; $ I <4; $ I ++)
{
ImageTTFText ($ im, rand (28, 32), rand (0, 70), rand ($ image_x/4) * $ I + $ image_x/10, ($ image_x/4) * $ I + $ image_x/8), rand ($ image_y/2 + $ image_y/10, $ image_y/2 + $ image_y/5), $ font_color, $ fnt, $ str [$ randnum + $ I]);
}
ImagePNG ($ im );
ImageDestroy ($ im );
?>

3. place a system font in the same directory of the vimage. php file and rename it to STXINGKA. TTF.

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.