一直提示這個錯誤是啥原因跟啊 warning: imagettftext(): Invalid font filename in,
$sess_name="verify";
$_SESSION[$sess_name]=$chars;
$fontfiles=array("SIMYOU.TTF");
for($i=0;$i<$length;$i++){
?? ?$size=mt_rand(14,18);
?? ?$angle=mt_rand(-15, 15);//角度
?? ?$x=5+$i*$size;
?? ?$y=mt_rand(20,26);
?? ?//putenv('GDFONTPATH=' . realpath('.'));
?? ?//$font = 'SomeFont';
?? ?$fontfile='../fonts/';
?? ?$color=imagecolorallocate($image,mt_rand(50,90),mt_rand(80,200),mt_rand(90,180));
?? ?$text=substr($chars, $i,1);
?? ?imagettftext($image, $size, $angle, $x, $y, $color, $fontfile, $text);
}
header("content-type:image/gif");
//ob_clean();
imagegif($image);
imagedestroy($image);
2016-03-28
你修改一下看看,最后不小心寫錯啦
2016-03-28
$fontfiles="SIMYOU.TTF";?//$fontfiles應該是個字符串;
$fontfile='../fonts/'.$fontfiles;//$fontfile應該是字體文件的路徑,你沒有寫具體的字體文件
不修改一下看看^_^