搜尋

首頁  >  問答  >  主體

加水印文字,中文會亂碼

<?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_huang2637 天前1425

全部回覆(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
  • 取消回覆