在PHP中的imagefilledrectangle()函数

PHPz
发布: 2023-08-30 09:06:02
转载
1070 人浏览过

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中的imagefilledrectangle()函数的详细内容。更多信息请关注PHP中文网其他相关文章!

相关标签:
来源:tutorialspoint.com
本站声明
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系admin@php.cn
热门教程
更多>
最新下载
更多>
网站特效
网站源码
网站素材
前端模板
关于我们 免责声明 Sitemap
PHP中文网:公益在线PHP培训,帮助PHP学习者快速成长!