imagefilledrectangle() 函数绘制一个填充矩形。
imagefilledrectangle( $img, $x1, $y1, $x2, $y2, $color )
image
使用imagecreatetruecolor()创建一个空白图像。
x1
点1的x坐标。
立即学习“PHP免费学习笔记(深入)”;
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中文网其它相关文章!
PHP怎么学习?PHP怎么入门?PHP在哪学?PHP怎么学才快?不用担心,这里为大家提供了PHP速学教程(入门到精通),有需要的小伙伴保存下载就能学习啦!
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号