20,359
社区成员
发帖
与我相关
我的任务
分享
<?php
//第一步 设置MIME类型,输出格式
$nmsg = '';
header("Content-Type:image/png;");
for ($i=0;$i<4;$i++)
{
$nmsg.=dechex(mt_rand(0,15));
}
//echo $nmsg;
//第二步 创建空白区域
$im=imagecreatetruecolor(200,200);
//第三步 创建imagecolorallocate为图像填充颜色
$blue=imagecolorallocate($im,0,102,255);
//第四步 将蓝色填充为背景
imagefill($im,0,0,$blue);
//第五步 填充文字
$white=imagecolorallocate($im,255,255,255);
imagestring($im,5,80,80,$nmsg,$white);
//第六步 首先输出看一下效果
imagepng($im);
//销毁,保持内存
imagedestroy($im);
?>
$nmsg = "";