当前位置:Gxlcms > PHP教程 > 水印乱码

水印乱码

时间:2021-07-01 10:21:17 帮助过:52人阅读

这段代码为什么加中文水印出现乱码,php页面是utf-8的。
$size = 20;
$angle = 0;
$fontfile = "simpo.ttf";
$text = "一二三";
$filename = "imgs/1.jpg";
$img = imagecreatefromjpeg($filename);
$white = imagecolorallocate($img, 255, 255, 255);
$x = 450;
$y = 550;
imagettftext($img, $size, $angle, $x, $y, $white, $fontfile, $text);
imagejpeg($img,"imgs/1_water.jpg");
imagedestroy($img);


回复讨论(解决方案)

simpo.ttf 是什么字体?
仅 128k 应该不是汉字

你的字?不支持?字,
把$text = "一二三";改?$text="abc"; ??。

还是不对,还没有找到问题,我会继续找问题,找到后发帖上来。

人气教程排行