Home  >  Article  >  Backend Development  >  Generate graphical verification code in php_PHP tutorial

Generate graphical verification code in php_PHP tutorial

WBOY
WBOYOriginal
2016-07-13 10:45:11846browse

We have talked a lot about generating graphical verification codes with PHP. This is a very simple tutorial suitable for beginners of PHP, a sample code for generating verification codes with PHP.

We have talked a lot about generating graphical verification codes in PHP tutorials. This is a very simple tutorial suitable for those who are getting started with PHP, with example codes for generating verification codes using PHP.

$height = 300;
$width = 300;
//Create background image
$im = ImageCreateTrueColor($width, $height);
//Assign color
$white = ImageColorAllocate ($im, 255, 255, 255);
$blue = ImageColorAllocate ($im, 0, 0, 64);
//Draw color to image
ImageFill($im, 0, 0, $blue);
//Draw string: Hello,PHP
ImageString($im, 10, 100, 120, 'Hello,PHP', $white);
//Output image, define header
Header ('Content-type: image/png');
//Send image to browser
ImagePng($im);
//Clear resources
ImageDestroy($im);
?>

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/633051.htmlTechArticleWe have talked a lot about generating graphical verification codes in PHP. This is a very simple tutorial suitable for PHP beginners. , a sample code that uses PHP to generate verification codes. About php tutorial generation...
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn