<?php
session_start();
Header("Content-type:image/PNG");
$num=substr((int)(rand()*1000),3,4);
$im = imagecreate(58,28);
$black = ImageColorAllocate($im, 21,200,150);
$white = ImageColorAllocate($im, 255,255,255);
$gray = ImageColorAllocate($im, 0,100,0);
imagefill($im,50,22,$gray);
imagestring($im, 5, 10, 8, $num, $white);
for($i=0;$i<50;$i++)
{
imagesetpixel($im, rand()%70 , rand()%30 , $gray);
}
ImagePNG($im);
ImageDestroy($im);
$_SESSION["imgCode"]=$num;
?>
热点搜索: php

