验证码不能得到
<?php require_once 'string.fuc.php'; $width = 90; $height = 30; $image = imagecreatetruecolor($width, $height); // 创建画布 $white = imagecolorallocate($image, 255, 255, 255); // 设置颜色 $black = imagecolorallocate($image, 0, 0, 0); // 填充一个矩形填充画布 imagefilledrectangle($image, 1, 1, $width - 2, $height - 2, $white); /*header("content-type:image/gif"); imagegif($image); imagedestroy($image);*/ $type=2; $length=5; $chars = buildRondString($type,$length); //echo $chars; imagettftext($image, 20, 0, 10, 20, $black, "simhei.ttf", $chars); header("content-type:image/png"); imagepng($image); imagedestroy($image);
单独的输出上面的画布和个那个随机字符串都能得到 但加上imagettftext()后个看不到图片了 这是为什么