【php开源代码栏目提醒】:本文主要为网学会员提供9_5.php,希望对需要9_5.php网友有所帮助,学习一下!
<?php
//在文件开始处输出头文件信息
header("Content-type: image/png");
//创建一个新图形
$image = imagecreate(400,200);
//设置图形背景
$bgColor = imagecolorallocate($image, 255, 255, 255);
//返回几个颜色备用
$black = imagecolorallocate($image,0,0,0);//黑色
$blue = imagecolorallocate($image,0,0,255);//蓝色
$red = imagecolorallocate($image,255,0,0);//红色
$green = imagecolorallocate($image,0,255,0);//绿色
//使用imageline()函数在不同位置画不同颜色的线段
imageline($image,5,5,100,100,$black);
imageline($image,20,5,305,125,$blue);
imageline($image,30,5,305,120,$red);
//画一条绿颜色的粗线
imageline($image,50,5,140,140,$green);
imageline($image,51,5,141,140,$green);
imageline($image,52,5,142,140,$green);
imageline($image,53,5,143,140,$green);
//输出PNG图像
imagepng($image);
//释放资源
imagedestroy($image);
?>