搜索

首页  >  问答  >  正文

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

<?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("内容类型:".$info['mime']);
$func = "图像{$type}";
$func($image);
$func($图像,'FFF.'.$type);
imagedestroy($image);

php_huangphp_huang2683 天前1454

全部回复(1)我来回复

  • ringa_lee

    ringa_lee2017-09-06 11:57:22

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

    回复
    0
  • php_huang

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

    php_huang · 2017-09-06 16:49:20
  • 取消回复