PHP development verification code tutorial to implement digital verification code

Implementing digital verification code


for ($i=0;$i<4;$i++){ //循环出四个数字 $fontsize = 6;//字体的大小为6 $fontcolor = imagecolorallocate($image,rand(0,120),rand(0,120),rand(0,120)); //定义字体的颜色 $fontcontent = rand(0,9);//定义字体的取值范围 }$x = ($i * 100/4)+rand(5,10); $y = rand(5,10); 在范围内随机定义坐标 imagestring($image,$fontsize,$x,$y,$fontcontent,$fontcolor); }

imagestring() uses col color to draw the string s to x of the image represented by image, y coordinate (this is the coordinate of the upper left corner of the string, the upper left corner of the entire image is 0, 0). If font is 1, 2, 3, 4 or 5, the built-in font is used.

Note:Control the size and distribution of fonts to avoid overlapping and incomplete display of fonts

Continuing Learning
||
submit Reset Code
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!