【php开源代码栏目提醒】:以下是网学会员为您推荐的php开源代码-9_34.php,希望本篇文章对您学习有所帮助。
<?php
//创建一个新图形
$image = imagecreate(400,200);
//设置背景,分配颜色
$bgColor = imagecolorallocate($image, 255, 255, 255);
$black = imagecolorallocate($image, 0, 0, 0);
//指定要使用的字体文件
$font = "simhei.ttf";
//用图形中输出字符串
imagettftext($image,20,0,10,50,$black,$font,"imagettftext()");
imagettftext($image,20,90,50,150,$black,$font,"imagettftext()");
imagettftext($image,20,180,300,100,$black,$font,"imagettftext()");
imagettftext($image,20,60,150,150,$black,$font,"imagettftext()");
imagettftext($image,20,360,200,50,$black,$font,"imagettftext()");
//输出图形
header('Content-type: image/png');
imagepng($image);
//释放资源
imagedestroy($image);
?>