検索

ホームページ  >  に質問  >  本文

透かしテキストを追加すると中国語が文字化けします

<?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_huangphp_huang2716日前1475

全員に返信(1)返信します

  • ringa_lee

    ringa_lee2017-09-06 11:57:22

    ヘッダーを先頭に追加します("Content-type: text/html; charset=utf-8");

    返事
    0
  • php_huang

    試してみましたが、うまくいきませんでした。ありがとうございます。

    php_huang · 2017-09-06 16:49:20
  • キャンセル返事