PHP 中的 imagefill() 函数
phpserver side programmingprogramming更新于 2025/7/6 15:52:17
imagefill() 函数用于填充图像。
语法
imagefill(img, x, y, color)
参数
img
使用 imagecreatetruecolor() 创建空白图像。x
起始点的 x 坐标y
起始点的 y 坐标color
填充颜色。
返回
imagefill() 函数在成功或失败时返回 TRUE失败时返回 FALSE。
示例
以下是示例:
<?php
$img = imagecreatetruecolor(400, 400);
$color = imagecolorallocate($img, 190, 255, 120);
imagefill($img, 0, 0, $color);
header('Content-type: image/png');
imagepng($img);
imagedestroy($img);
?>
输出
输出结果如下:


