龙盟编程博客 | 无障碍搜索 | 云盘搜索神器
快速搜索
主页 > web编程 > php编程 >

php画三角形

时间:2014-06-24 02:15来源:网络整理 作者:网络 点击:
分享到:
php画三角形 [代码片段(23行)]
<?php
     header ('Content-type: image/png');

     $im = ImageCreate (175, 175);

     $grey = ImageColorAllocate ($im, 230, 230, 230);
     $black = ImageColorAllocate ($im, 0, 0, 0);

     $coordinates = array();

     $coordinates[0] = 0;            // Point 1 x
     $coordinates[1] = 150;          // Point 1 y
     $coordinates[2] = 150;          // Point 2 x
     $coordinates[3] = 150;          // Point 2 y
     $coordinates[4] = 75;           // Point 3 x
     $coordinates[5] = 75;           // Point 3 y

     ImageFilledPolygon($im, $coordinates, 3, $black);

     ImageString($im, 3, 5, 5, 'Figure 18.4: Triangle', $black);
     ImagePng ($im);
     ImageDestroy ($im);
?>
精彩图集

赞助商链接