为什么这只显示背景图片,而不是文字? 没有backgroundimage就可以了......
$code = rand(1000, 99999);
$_SESSION["code"] = $code;
$font = '../fonts/captcha.ttf';
$y = 30;
$x = 10;
$width = 100; //Image width in pixels
$height = 40; //Calculating image height
$image = ImageCreate($width, $height);
$img = imagecreatefromgif('img/captcha.gif');
$bgtext = imagecolorallocate($img, 145,145,145);
ImageTTFText($image, 16, 0, $y, $y, $bgtext, $font, $code);
header('Content-type: image/png');
imagegif($img);
imagedestroy($img);