PHP中GD2的运用,注意编码格式的改变,以及head()函数之前不能有任何html元素包括空格!!!

<?php
header ( "Content-type: text/html; charset=utf-8" ); //设置文件编码格式
header("Content-type: image/jpeg"); //告知浏览器所要输出图像的类型
$img = imagecreate(, ); //创建画布
$bg = imagecolorallocate($img, , , ); //定义背景颜色
$red = imagecolorallocate($img, , , ); //设置字符串颜色
$text="I like PHP";
iconv("gbk","utf-8", $text);// 将GBK编码格式转换成UTF-8格式
imagestring($img, , , , $text, $red); //输出英文字符串
imagejpeg($img); //输出图像
imagedestroy($img); //释放内存
?>
上一篇:C# signtool error:no certificates were found that met all the given criteria 错误解决方案


下一篇:JDK动态代理深入理解分析并手写简易JDK动态代理(下)