jpgraph图形类库中文乱码解决
来源:岁月联盟
时间:2008-12-25
2、找到src/jpgraph.php文件,将FF_CHINESE部分屏蔽
/*
elseif( $aFF === FF_CHINESE ) {
if( !function_exists('iconv') ) {
JpGraphError::Raise('Usage of FF_CHINESE (FF_BIG5)
font family requires that your PHP setup has the iconv() function.
By default this is not compiled into PHP (needs the "--width-iconv"
when configured).');
}
return iconv('BIG5','UTF-8',$aTxt);
*/
3、应用,以srcExamples的accbarex1.php为例
$graph->title->Set("Accumulated bar plots");
改为
$graph->title->Set("中文测试");
$graph->title->SetFont(FF_FONT1,FS_BOLD);
改为
$graph->title->SetFont(FF_SIMSUN,FS_BOLD);
//如果有x或y轴,则用下面语句
$graph->legend->SetFont(FF_SIMSUN,FS_NORMAL);
运行程序,中文乱码问题OK