/************************
解决jpgraph汉字乱码的两种方法
第一种方法:将SetFont函数第一个参数设置为FF_SIMSUN,将jpgraph_ttf.inc.php中修改为
elseif( $aFF === FF_SIMSUN ) {
//注释掉下面代码,解决中文乱码问题
// Do Chinese conversion
// if( $this->g2312 == null ) {
// include_once ‘jpgraph_gb2312.php’ ;
// $this->g2312 = new GB2312toUTF8();
// }
// return this−>g2312−>gb2utf8(this->g2312->gb2utf8(this−>g2312−>gb2utf8(aTxt);
return $aTxt;
}
第二种方法:将SetFont函数第一个参数设置为FF_SIMSUN;不修改jpgraph_ttf.inc.php中的内容,则使用函数将utf8转换为gb2312
$x=“这是统计表”;
b=iconv("UTF−8","gb2312",b=iconv("UTF-8","gb2312",b=iconv("UTF−8","gb2312",x);
graph−>title−>Set("graph->title->Set("graph−>title−>Set("x");
*/
$bt="这是统计表";$b=iconv("UTF-8","gb2312",$bt);$graph->title->Set("$b");$xz="x轴";$x=iconv("UTF-8","gb2312",$xz);$graph->xaxis->title->Set("$x");$graph->yaxis->title->Set("Y-title");$graph->title->SetFont(FF_SIMSUN,FS_BOLD);$graph->yaxis->title->SetFont(FF_SIMSUN,FS_BOLD);$graph->xaxis->title->SetFont(FF_SIMSUN,FS_BOLD);
如果觉得《解决jpgraph汉字乱码的两种方法》对你有帮助,请点赞、收藏,并留下你的观点哦!