首页 > php图像处理 > php生成图形验证码

php生成图形验证码

关于php生成图形验证码我们讲过很多,这是一个非常简单的适合于php入门者的教程,一个用php生成验证码的实例代码.

<?php 
	$height = 300; 
	$width = 300; 
	//创建背景图 
	$im = ImageCreateTrueColor($width, $height); 
	//分配颜色 
	$white = ImageColorAllocate ($im, 255, 255, 255); 
	$blue = ImageColorAllocate ($im, 0, 0, 64); 
	//绘制颜色至图像中 
	ImageFill($im, 0, 0, $blue);//开源代码phprm.com 
	//绘制字符串:Hello,PHP 
	ImageString($im, 10, 100, 120, 'Hello,PHP', $white); 
	//输出图像,定义头 
	Header ('Content-type: image/png'); 
	//将图像发送至浏览器 
	ImagePng($im); 
	//清除资源 
	ImageDestroy($im); 
	 

本文地址:http://www.phprm.com/tuxiang/fs4493.html

转载随意,但请附上文章地址:-)

标签:php验证码类 php生成验证码

相关文章

发表留言