我为验证码创建了一个小代码。我在apache2上运行PHP。当我测试它时,页面上没有加载图像,它显示为空白。我也检查GD,它已经安装。
这是PHP代码:
<?php
$img = imagecreatetrucolor(80,30);
$white = imagecolorallocate($img, 255, 255, 255);
$black = imagecolorallocate($img, 0, 0, 0);
$red = imagecolorallocate($img, 255, 0, 0);
$pink = imagecolorallocate($img, 2250, 0, 150);
imagefill($img, 0, 0, $black);
header("Content-type: image/png");
imagepng($img);
imagedestroy($img);
?>
任何建议都会有很大的帮助!!