imagefilledrectangle() 函数画一矩形并填充。
语法:
bool imagefilledrectangle( resource image, int x1, int y1, int x2, int y2, int color )
x1,y1为左上角左边,x2,y2为右下角坐标。
例子:
<?php
header('Content-type: image/png');
$im = imagecreatetruecolor(200, 200);
$yellow = imagecolorallocate($im, 255, 255, 0);
imagefilledrectangle($im, 20, 150, 40, 200, $yellow);
imagefilledrectangle($im, 50, 80, 70, 200, $yellow);
imagepng($im);
imagedestroy($im);
?>
该函数典型应用之一是柱状统计图。