【php开源代码栏目提醒】:网学会员,鉴于大家对php开源代码十分关注,论文会员在此为大家搜集整理了“9_36.php”一文,供大家参考学习!
<?php
//创建一个新图形
$image = imagecreatetruecolor(400,100);
//分配颜色
$bgColor = imagecolorallocate($image,250,250,250);
$black = imagecolorallocate($image,0,0,0);
//填充背景
imagefill($image,0,0,$bgColor);
//指定imagettftext()函数使用的字体
$font = "simhei.ttf";
//字义要输出的中文字符串
$string = "这是PNG图形";
//对中文字符进行编码
$codeString = iconv("GB2312","UTF-8",$string);
//使用imagettftext()函数输出文字
imagettftext($image,20,0,30,30,$black,$font,$codeString);
//把PNG图形保存为文件
imagepng($image,"pngfile.png");
//把PNG图形输出到浏览器
header("Content-type: image/png");
imagepng($image);
//释放资源
imagedestroy($image);
?>
上一篇:
9_35.php
下一篇:
高职院理实一体信息技术论文