在PHP中的imagefilledrectangle()函数
imagefilledrectangle() 函数绘制一个填充矩形。
语法
imagefilledrectangle( $img, $x1, $y1, $x2, $y2, $color )
参数
image
使用imagecreatetruecolor()创建一个空白图像。
x1
点1的x坐标。
y1
点1的y坐标。
x2
点2的x坐标。
y2
点2的y坐标。
color
填充颜色。
返回值
imagefilledrectangle()函数成功返回TRUE,失败返回FALSE。
示例
以下是一个示例:
<?php
// Create an image
$img = imagecreatetruecolor(500, 300);
$color = imagecolorallocate($img, 0, 128, 128);
imagefilledrectangle($img, 30, 30, 470, 270, $color);
header("Content-type: image/png");
imagepng($img);
imagedestroy($img);
?>输出
以下是输出结果:

以上就是在PHP中的imagefilledrectangle()函数的详细内容,更多请关注其它相关文章!
Php