首页 >

php的GD库imagettftext函数解决中文乱码问题【PHP】

后端开发|php教程php的GD库imagettftext函数解决中文乱码问题【PHP】
php,GD库,imagettftext,函数,解
后端开发-php教程
本文实例讲述了php的GD库imagettftext函数解决中文乱码问题的方法。分享给大家供大家参考。具体如下:
网站crm源码,Ubuntu无法卸载xrdp,tomcat服务器与ftp,java基于网络爬虫,兄弟连php毕业视频,seo运营分工lzw
使用imagettftext写中文时,常出现乱码问题。解决方法是将中文字符串转为utf-8格式即可。具体代码如下(文件格式为gb2312):
linux echo 源码,vscode搜索不好用了,ubuntu配置系统,tomcat 编译后路径,爬虫需要cookie,php随机出题,上海品质seo优化使用方法lzw
<?php
$im = imagecreatefromjpeg(‘./1.jpg’);
$w = imagesx($im);
$h = imagesy($im);
java权限管理系统源码下载,vscode怎么看版本号,ubuntu 查询 ip,mac搭建tomcat运行环境,blob 视频 爬虫,女生学php好吗,滦县知名的seo优化哪家好lzw
$green = imagecolorallocate($im,50,100,200);
$str = iconv(‘gb2312′,’utf-8′,’幸福就在身边’);//解决乱码问题
imagettftext($im,16,0,200,100,$green,’./simhei.ttf’,$str);

header(“content-type: image/jpeg”);
imagejpeg($im);
imagedestroy($im);
?>