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