一 代码
<?php header("Content-type: image/png"); //将图像输出到浏览器 $img = imagecreate(400, 200); //创建一个 400×180 的图像 $bg = imagecolorallocate($img, 0, 0, 255); $white = imagecolorallocate($img, 255, 0, 255); imagefilledellipse($img, 100, 100, 150, 150, $white); //绘制圆形 imagefilledrectangle($img, 200, 50, 300, 150, $white); //绘制正方形 imagepng($img); imagedestroy($img); ?>
二 运行结果