PHP验证码图像不起作用

时间:2014-07-25 07:01:02

标签: captcha

我已尝试使用此代码创建验证码图像

    <?PHP
      header('Content-type: image/jpeg');
       $size=25;
       $captha_width=100;
       $captha_height=40;
       $text=rand(10000,99999);

       $captha=imagecreate($captha_width,$captha_height);
       imagecolorallocate($captha,192,192,192);
       $color=imagecolorallocate($captha,10,10,10);

    for($i=1;$i<30;++$i){
     $a1=rand(0,100);
     $a2=rand(0,100);
     $a3=rand(0,100);
     $a4=rand(0,100);

    imageline($captha,$a1,$a2,$a3,$a4,$color);
    }
  imagettftext($captha,$size,0,15,30,$color,'face.ttf',$text);
  imagejpeg($captha);
 ?>

但是当我在浏览器中打开它时,它只显示损坏的图像图标为什么???

0 个答案:

没有答案