我试图改变$font_size
但现在看来,这是行不通的。无论如何,它都保持不变。即使我改变了$font_size
高达130它保持不变:PHP FONT_SIZE验证码问题
<?php
header('Content-type: image/png');
$rand_num = rand(1000, 9999);
$font_size = 130;
$image_width = 110;
$image_height = 20;
$image = imagecreate($image_width, $image_height);
imagecolorallocate($image, 255, 255, 255);
$black_color = imagecolorallocate($image, 0, 0, 0);
imagestring($image, $font_size, 0, 0, $rand_num, $black_color);
for($x=0; $x <= 30; $x++){
$x1 = rand(1, 100);
$y1 = rand(1, 100);
$x2 = rand(1, 100);
$y2 = rand(1, 100);
imageline($image, $x1, $y1, $x2, $y2, $black_color);
}
imagepng($image);
?>
那么对于latin2编码的内置字体,最大值只能是5呢? – user1995927
是的,这是正确的,否则你可以使用imageloadfont() –
imageloadfont加载自定义字体()?它与imagettftext()相同吗? – user1995927