php生成验证码实例代码
来源:未知 责任编辑:智问网络 发表时间:2013-10-30 11:07 点击:次
	   
	
	  
	  
	  下面是生成验证码代码,结果编程之家本站测试过,没错误贴上来的。如果有什么不懂的地方可以回复,编程之家会为你解释不了解之处。希望能对你有所收获。
	
	- <?php
 - session_start();
 - $nums = rand(1000,9999);
 - $_SESSION[nums]=$nums;
 - $imgs = ImageCreatetruecolor(100, 35);
 - $one = Imagecolorallocate($imgs, 0, 0, 0);
 - $two = Imagecolorallocate($imgs, rand(0, 255), rand(0, 255), rand(0, 255));
 - $thr = Imagecolorallocate($imgs, rand(50, 200), rand(100, 255), rand(150, 255));
 - Imagestring($imgs, 6, rand(5, 60), rand(3, 18), $nums, $two);
 - for ($i = 1; $i <= 3; $i ) {
 - imageline($imgs, rand(0, 0), rand(0, 25), rand(70, 100), rand(0, 25), $thr);
 - }
 - for ($i = 1; $i <= 200; $i ) {
 - imagesetpixel($imgs,rand()0,rand()5,$two);
 - }
 - Header("Content-type:image/jpeg");
 - imagejpeg($imgs);
 - ?>
 
相关新闻>>
- 发表评论
 - 
				
 
- 最新评论 进入详细评论页>>
 





![smarty局部缓存技术[源码分析]](/uploads/allimg/130827/11214T939-0-lp.jpg)