<?php
/*
@author sanshi
QQ:35047205
Email:sanshi0815@tom.com
MSN:sanshi0815@tom.com
*/
$string=md5(rand(1,1000));
$string=substr($string,0,4);
$len=strlen($string);
$bordercolor = "#000000";
$bgcolor = "#ffffff";//背景色
$height = 30;
$width = 60;
$image = imageCreate($width, $height);
//画边框
$bordercolor = getcolor($image,$bordercolor);
imagefilledrectangle($image,0,0,$width+1,$height+1,$bordercolor);
//画背景
$back = getcolor($image,$bgcolor);
imagefilledrectangle($image,1,1,$width-2,$height-2,$back);
//画干扰元素
$num = 200; //干扰元素的个数
setnoise($image,$width,$height,$num);
//字体大小
$size = ceil($width / $len);
//写字
for($i=0;$i<$len;$i++)
{
$TempText=substr($string,$i,1);
//字体颜色
$textColor = imag