<?php
$width=500;
$height=300;
//创建画布
$img=imageCreateTrueColor($width,$height);
//分配颜色
$green=imageColorAllocate($img,0,255,0);
//填充画布
imageFill($img,0,0,$green);
//输出到文件 ./green.png
imagePNG($img,'./green.png');
//直接输出
header('Content-Type: image/png');
imagePNG($img);
//销毁画布资源
imageDestroy($img);
var_dump($green);
?>
php中GD的使用
最新推荐文章于 2021-07-29 18:02:00 发布