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);
?>输出
以下为输出

广告
数据结构
网络
RDBMS
操作系统
Java
iOS
HTML
CSS
Android
Python
C 编程
C++
C#
MongoDB
MySQL
Javascript
PHP