【php开源代码栏目提醒】:网学会员php开源代码为您提供9_28.php参考,解决您在9_28.php学习中工作中的难题,参考学习。
<?php
//创建一个新图形
$image = imagecreate(400,100);
//设置背景,分配颜色
$white = imagecolorallocate($image, 255, 255, 255);
$black = imagecolorallocate($image, 0, 0, 0);
//在风格参数数组中设置颜色,将前5个像素设置为黑色,将后5个像素设置为白色
$style = array($black,$black,$black,$black,$black,$black,$white,$white,$white,$white,$white);
//使用imagesetstyle()设置画线风格
imagesetstyle($image, $style);
//使用设置好的样式画一条线
imageline($image,10,10,380,80, IMG_COLOR_STYLED);
//输出图形
header("Content-type: image/png");
imagepng($image);
//释放资源
imagedestroy($image);
?>