php产生的网站验证码不显示,求大神

<?php session_start(); session_register("randcode"); $type = ✀png✀;$width= 50;$height= 20;$randval = randStr(4,"");$_SESSION[✀randcode✀] = $randval;//print_r($_SESSION);exit;header("Content-type: image/".$type);srand((double)microtime()*1000000);if($type!=✀png✀ && function_exists(✀imagecreatetruecolor✀)){$im = @imagecreatetruecolor($width,$height);}else{$im = @imagecreate($width,$height);}$r = Array(210,50,120);$g = Array(240,225,235);$b = Array(250,225,10);$rr = Array(255,240,0);$gg = Array(100,0,0);$bb = Array(0,0,205);$key = rand(0,2);$stringColor = ImageColorAllocate($im,255,255,255); //字体颜色$backColor = ImageColorAllocate($im,418,121,226);//背景色(随机)$borderColor = ImageColorAllocate($im, 416, 140, 232);//边框色$pointColor = ImageColorAllocate($im, 18,121,226);//点颜色@imagefilledrectangle($im, 0, 0, $width - 1, $height - 1, $backColor);//背景位置@imagerectangle($im, 0, 0, $width-1, $height-1, $borderColor); //边框位置/*for($i=0;$i<=200;$i++){$pointX = rand(2,$width-2);$pointY = rand(2,$height-2);@imagesetpixel($im, $pointX, $pointY, $pointColor);//绘模糊作用的点}*/@imagestring($im, 5, 7, 3, $randval, $stringColor); //调整字型位置$ImageFun=✀Image✀.$type;$ImageFun($im);@ImageDestroy($im);//产生随机字符串function randStr($len=6,$format=✀ALL✀) {switch($format) {/*case ✀ALL✀:$chars=✀ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789✀; break;case ✀CHAR✀:$chars=✀ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz✀; break;case ✀NUMBER✀:$chars=✀0123456789✀; break;*/default :$chars=✀0123456789✀;break;}$string="";while(strlen($string)<$len)$string.=substr($chars,(mt_rand()%strlen($chars)),1);return $string;}?>
2026年09月22日 05:04
有1个网友回答
网友(1):

php什么版本的?
如果是php5
session_register("randcode"); 不支持
删除即可