看看小弟我在注册码不显示。显示为红叉。哪位高手帮忙解决下

WBOY
Release: 2016-06-13 12:41:48
Original
799 people have browsed it

看看我在注册码不显示。显示为红叉。谁帮忙解决下?

<br />
<?php<br />
/**<br />
* TestGuest Version1.0<br />
* ================================================<br />
* Copy 2010-2012 yc60<br />
* Web: http://www.yc60.com<br />
* ================================================<br />
* Author: Lee<br />
* Date: 2010-8-13<br />
*/<br />
session_start();<br />
<br />
//随机码的个数<br />
$_rnd_code = 4;<br />
<br />
//创建随机码<br />
for ($i=0;$i<$_rnd_code;$i++) {<br />
	$_nmsg .= dechex(mt_rand(0,15));<br />
}<br />
<br />
//保存在session<br />
$_SESSION['code'] = $_nmsg;<br />
<br />
//长和高<br />
$_width = 75;<br />
$_height = 25;<br />
<br />
//创建一张图像<br />
$_img = imagecreatetruecolor($_width,$_height);<br />
<br />
//白色<br />
$_white = imagecolorallocate($_img,255,255,255);<br />
<br />
//填充<br />
imagefill($_img,0,0,$_white);<br />
<br />
$_flag = false;<br />
<br />
if ($_flag) {<br />
	//黑色,边框<br />
	$_black = imagecolorallocate($_img,0,0,0);<br />
	imagerectangle($_img,0,0,$_width-1,$_height-1,$_black);<br />
}<br />
<br />
//随即画出6个线条<br />
for ($i=0;$i<6;$i++) {<br />
	$_rnd_color = imagecolorallocate($_img,mt_rand(0,255),mt_rand(0,255),mt_rand(0,255));<br />
	imageline($_img,mt_rand(0,$_width),mt_rand(0,$_height),mt_rand(0,$_width),mt_rand(0,$_height),$_rnd_color);<br />
}<br />
<br />
//随即雪花<br />
for ($i=0;$i<100;$i++) {<br />
	$_rnd_color = imagecolorallocate($_img,mt_rand(200,255),mt_rand(200,255),mt_rand(200,255));<br />
	imagestring($_img,1,mt_rand(1,$_width),mt_rand(1,$_height),'*',$_rnd_color);<br />
}<br />
<br />
//输出验证码<br />
for ($i=0;$i<strlen($_SESSION['code']);$i++) {<br />
	$_rnd_color = imagecolorallocate($_img,mt_rand(0,100),mt_rand(0,150),mt_rand(0,200));<br />
	imagestring($_img,5,$i*$_width/$_rnd_code+mt_rand(1,10),mt_rand(1,$_height/2),$_SESSION['code'][$i],$_rnd_color);<br />
}<br />
<br />
//输出图像<br />
header('Content-Type: image/png');<br />
imagepng($_img);<br />
<br />
//销毁<br />
imagedestroy($_img);<br />
<br />
<br />
<br />
<br />
<br />
<br />
?><br />
<br />
Copy after login


有高人吗?

Color
Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!