添加水印文字,中文会乱码

<?php
$src = "02.png";
$info = getimagesize($src);
$type = image_type_to_extension($info[2],false);
$fun = "imagecreatefrom{$type}";
$image = $fun($src);
$font = "arial.ttf";
$content = "欢迎来到PHP中文网";
$col = imagecolorallocatealpha($image, 255, 255, 255, 30);
imagettftext($image, 20, 0, 20, 30, $col, $font, $content);
header("content-type:".$info['mime']);
$func = "image{$type}";
$func($image);
$func($image,'FFF.'.$type);
imagedestroy($image);

提问者php_huang提问时间:2017-09-06 10:32我来回答
1回答
ringa_lee
回复ringa_lee赞同02星期前

前面加个header头,header("Content-type: text/html; charset=utf-8");

  • php_huang
    试了,没有用,也谢谢你了