<?php
header("Content-type:image/png");
Set the size of a picture
$image = Imagecreatetruecolor(+ );
Set the background value of an image
$bgcolor = imagecolorallocate ($image, 255, 255, 255);
Imagefill ($image, 0, 0, $bgcolor);
Generate random numbers
For ($i = 0; $i < 4; $i+ +) {
$fontsize = 6;
//color of the generated font
$fontcolor = imagecolorallocate ($image, rand (0, $ ), rand (0, $ ), rand ( 0) );
//Create a range of fonts
$fontcontent = rand (0, 9);
//The coordinates of the generated numbers
$x = ($i*4) + rand (5, Ten);
$y = rand (5, Ten);
//Draw a random number on the picture
imagestring ($image, $fontsize, $x, $y, $fontcontent, $fontcolor);
}
Add interference point elements
For ($i = 0; $i < $i+ +) {
$pointcolor = imagecolorallocate ($image, rand (+), rand ( 200), C19>rand (a );
//Draw a single pixel
imagesetpixel ($image, rand (0, ( ), rand (0), $pointcolor);
}
Increase interference Line
For ($i = 0; $i<3; $i+ +) {
$linecolor = imagecolorallocate ($image, rand (+ ) , rand (+), rand ( C11>80, ( ));
//Draw a line segment
imageline ($image, rand (1 ), rand (1, ), Rand (1, ), rand ( 1 ), $linecolor);
}
imagepng ($image);
Destroyed
Imagedestroy($image);
?>
PHP makes a simple verification code