Home  >  Article  >  php教程  >  JpGraph使用详解之中文乱码解决方法

JpGraph使用详解之中文乱码解决方法

WBOY
WBOYOriginal
2016-06-07 17:23:001157browse

在前面的JpGraph使用详解这篇文章,已经对JpGraph的使用方法作了详细的交代,前面说好的,接下来解决中文乱码。

JpGraph为什么会出现中文乱码

在JpGraph中默认是要把字符串转成utf8的,但是如果你的文件本身就是utf8的,并且要用中文字体,它还会转一遍,结果多转了一次,就会出现乱码。如图所示

JpGraph使用详解之中文乱码解决方法


解决中文乱码

取前篇的代码片断如下

//设置图表的标题字体、大小
$graph->title->Set("Accumulated bar plots");
$graph->xaxis->title->Set("X-title");
$graph->yaxis->title->Set("Y-title");

//和上面标题对应,设置标题的字体和大小
$graph->title->SetFont(FF
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn