为什么的代码报错
<?php
header('content-type:text/html;charset=utf-8');
function getVerify($fontFile,$width=500,$height=60)
{
$image= imagecreatetruecolor($width, $height);
$rect_color=imagecolorallocate($image,255,0,0);
imagerectangle($image,0,0,$width,$height,$rect_color);
$rand_color=imagecolorallocate($image,mt_rand(0,255),mt_rand(0,255),mt_rand(0,255));
$string=join('',array_merge(range('A','Z'),range('a','z'),range(1,9)));
$len=4;
$textWidth=imagefontwidth(20);
$textHeight=imagefontheight(20);
function getRandColor($image)
{
return imagecolorallocate($image,mt_rand(0,255),mt_rand(0,255),mt_rand(0,255));
}
for($i=0;$i<$len;$i++)
{
$size= mt_rand(20,30);
$angle= mt_rand(-20,20);
$x=($width/$len)*$i+$textWidth;
$y=mt_rand($height/2,$height-$textHeight);
$fontFile='../font/consola.ttf';
$rand_color=imagecolorallocate($image,mt_rand(0,255),mt_rand(0,255),mt_rand(0,255));
$code1=str_shuffle($string);
$code=$code1{0};
imagettftext($image, $size, $angle,$x,$y,$rand_color,$fontFile,$code);
}
for($i=0;$i<100;$i++)
{
imagesetpixel($image,mt_rand(0,$width),mt_rand(0,$height),getRandColor($image));
}
for($i=0;$i<5;$i++)
{
imageline($image,mt_rand(0,$width),mt_rand(0,$height), mt_rand(0,$width),mt_rand(0,$height), getRandColor($image));
}
for($i=0;$i<6;$i++)
{
imagearc($image, mt_rand(0,$width),mt_rand(0,$height), mt_rand(0,$width/2), mt_rand(0,$height/2), mt_rand(0,360),mt_rand(0,360),getRandColor($image));
}
header('content-type:image/jpeg');
imagejpeg($image);
imagedestroy($image);
}
getVerify();