windows用户到 C:\WINDOWS\Fonts 目录下找一个你要用的中文的字体 ttf文件。

我用的是华文宋体(TrueType) 放到你要运行的php文件的目录下,这个你随便放,路径不写错就可以

 

代码
<?php
// set up image 
$im = ImageCreateTrueColor(200, 200);
$black = ImageColorAllocate ($im, 0, 0, 0);
$white = ImageColorAllocate ($im, 255, 255, 255);

$wenben = "简体中文";
ImageFill(
$im, 0, 0, $black);
ImageLine(
$im, 0, 0, 200, 200, $white);
$font = "E:\\xampp\\htdocs\\test\\gd\\STSONG.TTF";

imagettftext(
$im, 12, 0, 50, 150, $white , $font, $wenben);

// output image
Header ('Content-type: image/png');
ImagePng(
$im);
// clean up 
ImageDestroy($im);
?>

$font = "E:\\xampp\\htdocs\\test\\gd\\STSONG.TTF"; windows的路径要加上转义符,另外STSONG.TTF 这个文件名黏贴的时候自动就命名的。