首页 后端开发 php教程 用PHP的GD库画的两个几何图

用PHP的GD库画的两个几何图

Jun 23, 2016 pm 01:25 PM

//code6.php    没有函数化

<?php header("Content-type:image/png");$img=imagecreatetruecolor(400, 400);$black=imagecolorallocate($img, 0, 0, 0);$red=imagecolorallocate($img, 255, 0, 0);$green=imagecolorallocate($img, 0, 255, 0);$blue=imagecolorallocate($img, 0, 0, 255);imagefill($img, 0, 0, $black);imageline($img, 0, 0, 400, 400, $green);imageline($img, 40, 0, 400, 400, $green);imageline($img, 80, 0, 400, 400, $green);imageline($img, 120, 0, 400, 400, $green);imageline($img, 160, 0, 400, 400, $green);imageline($img, 200, 0, 400, 400, $green);imageline($img, 240, 0, 400, 400, $green);imageline($img, 280, 0, 400, 400, $green);imageline($img, 320, 0, 400, 400, $green);imageline($img, 360, 0, 400, 400, $green);imageline($img, 390, 0, 400, 400, $green);imageline($img, 0, 40, 400, 400, $green);imageline($img, 0, 80, 400, 400, $green);imageline($img, 0, 120, 400, 400, $green);imageline($img, 0, 160, 400, 400, $green);imageline($img, 0, 200, 400, 400, $green);imageline($img, 0, 240, 400, 400, $green);imageline($img, 0, 280, 400, 400, $green);imageline($img, 0, 320, 400, 400, $green);imageline($img, 0, 360, 400, 400, $green);imageline($img, 0, 390, 400, 400, $green);imageline($img, 0, 400, 400, 0, $green);imageline($img, 0, 400, 400, 40, $green);imageline($img, 0, 400, 400, 80, $green);imageline($img, 0, 400, 400, 120, $green);imageline($img, 0, 400, 400, 160, $green);imageline($img, 0, 400, 400, 200, $green);imageline($img, 0, 400, 400, 240, $green);imageline($img, 0, 400, 400, 280, $green);imageline($img, 0, 400, 400, 320, $green);imageline($img, 0, 400, 400, 360, $green);imageline($img, 0, 400, 400, 390, $green);imageline($img, 0, 400, 360, 0, $green);imageline($img, 0, 400, 320, 0, $green);imageline($img, 0, 400, 280, 0, $green);imageline($img, 0, 400, 240, 0, $green);imageline($img, 0, 400, 200, 0, $green);imageline($img, 0, 400, 160, 0, $green);imageline($img, 0, 400, 120, 0, $green);imageline($img, 0, 400, 80, 0, $green);imageline($img, 0, 400, 40, 0, $green);imageline($img, 0, 400, 10, 0, $green);imagepng($img);?>
登录后复制

//code7.php 函数化处理

<?php header("Content-type:image/png");$img=imagecreatetruecolor(400, 400);$black=imagecolorallocate($img, 0, 0, 0);$red=imagecolorallocate($img, 255, 2550, 0);$green=imagecolorallocate($img, 0, 255, 0);$blue=imagecolorallocate($img, 0, 0, 255);imagefill($img, 0, 0, $black);for($i=0;$i<=400;$i+=10){imageline($img, 0, $i, 200, 200, $red);}for($j=0;$j<=400;$j+=20){imageline($img, $j, 0, 200, 200, $red);}for($x=0;$x<=400;$x+=10){imageline($img, 200, 200, 400, $x, $red);}for($y=0;$y<=400;$y+=20){imageline($img, 200, 200, $y, 400, $red);}imagepng($img);?>
登录后复制

//code6.png

//code7.png


本站声明
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系admin@php.cn

热门文章

仓库:如何复兴队友
3 周前 By 尊渡假赌尊渡假赌尊渡假赌
R.E.P.O.能量晶体解释及其做什么(黄色晶体)
1 周前 By 尊渡假赌尊渡假赌尊渡假赌
Hello Kitty Island冒险:如何获得巨型种子
3 周前 By 尊渡假赌尊渡假赌尊渡假赌

热门文章

仓库:如何复兴队友
3 周前 By 尊渡假赌尊渡假赌尊渡假赌
R.E.P.O.能量晶体解释及其做什么(黄色晶体)
1 周前 By 尊渡假赌尊渡假赌尊渡假赌
Hello Kitty Island冒险:如何获得巨型种子
3 周前 By 尊渡假赌尊渡假赌尊渡假赌

热门文章标签

记事本++7.3.1

记事本++7.3.1

好用且免费的代码编辑器

SublimeText3汉化版

SublimeText3汉化版

中文版,非常好用

禅工作室 13.0.1

禅工作室 13.0.1

功能强大的PHP集成开发环境

Dreamweaver CS6

Dreamweaver CS6

视觉化网页开发工具

SublimeText3 Mac版

SublimeText3 Mac版

神级代码编辑软件(SublimeText3)

11个最佳PHP URL缩短脚本(免费和高级) 11个最佳PHP URL缩短脚本(免费和高级) Mar 03, 2025 am 10:49 AM

11个最佳PHP URL缩短脚本(免费和高级)

Instagram API简介 Instagram API简介 Mar 02, 2025 am 09:32 AM

Instagram API简介

在Laravel中使用Flash会话数据 在Laravel中使用Flash会话数据 Mar 12, 2025 pm 05:08 PM

在Laravel中使用Flash会话数据

构建具有Laravel后端的React应用程序:第2部分,React 构建具有Laravel后端的React应用程序:第2部分,React Mar 04, 2025 am 09:33 AM

构建具有Laravel后端的React应用程序:第2部分,React

简化的HTTP响应在Laravel测试中模拟了 简化的HTTP响应在Laravel测试中模拟了 Mar 12, 2025 pm 05:09 PM

简化的HTTP响应在Laravel测试中模拟了

php中的卷曲:如何在REST API中使用PHP卷曲扩展 php中的卷曲:如何在REST API中使用PHP卷曲扩展 Mar 14, 2025 am 11:42 AM

php中的卷曲:如何在REST API中使用PHP卷曲扩展

在Codecanyon上的12个最佳PHP聊天脚本 在Codecanyon上的12个最佳PHP聊天脚本 Mar 13, 2025 pm 12:08 PM

在Codecanyon上的12个最佳PHP聊天脚本

Laravel中的通知 Laravel中的通知 Mar 04, 2025 am 09:22 AM

Laravel中的通知

See all articles