在设计验证码时出现
The image "http://localhost/tapiv.php" cannot be displayed, because it contains errors.
并没办法将图形显示出来, 程序如下, 请问是什么问题? 谢谢
<?php
Header("Content-type: image/PNG");
srand((double)microtime()*1000000);
$im = imagecreate(62,20);
$black = ImageColorAllocate($im, 0,0,0);
$white = ImageColorAllocate($im, 255,255,255);
$gray = ImageColorAllocate($im, 200,200,200);
imagefill($im,0,0,$gray);
@session_start();
if(session_unregister ('mytmp_authn')) { session_register('mytmp_authn'); }
while(($_SESSION['mytmp_authn']=rand()%100000)<10000);
$authnum=$_SESSION[mytmp_authn];
imagestring($im, 5, 10, 3, $authnum, $black);
for($i=0;$i<200;$i++)
{
$randcolor = ImageColorallocate($im,rand(0,255),rand(0,255),rand(0,255));
imagesetpixel($im, rand()%70 , rand()%30 , $randcolor);
}
ImagePNG($im);
ImageDestroy($im);
?> |