代码如下:记得要存为utf-8编码文件,否则汉字显示乱码
<?
header("Content-type: image/jpeg");
  $im = imagecreate(500,30);
  $white = imagecolorallocate($im, 255,255,0);
  $black = imagecolorallocate($im, 0,0,255);
  
  // Replace path by your own font path
  imagettftext($im, 20, 0, 10, 20, $black, "C:/windows/fonts/simsun.ttc",
  "Testing...你好,方块字!...");
  imagejpeg($im);
  imagedestroy($im);
?>