今天設置了jpgraph生成的圖表加上中文標題亂碼,搜索下結果都是加什么字體了設置這個,修改那個。。后來看到這個文章:http://anshao.net/codes/254.html(多謝博主分享了,我轉載了過來,在windows是可以使用滴,但是linux下就不可以,我就增加下怎么在linux下使用吧)
具體做法就是:修改jpgraph_ttf.inc.php,找到185行:elseif( $aFF === FF_SIMSUN ) {
這個里面的內容
elseif( $aFF === FF_SIMSUN ) {
// Do Chinese conversion if( $this->g2312 == null ) { include_once ‘jpgraph_gb2312.php’ ; $this->g2312 = new GB2312toUTF8(); } return $this->g2312->gb2utf8($aTxt); } 修改為: elseif( $aFF === FF_SIMSUN ) {
// Do Chinese conversion //注釋掉這段; /*if( $this->g2312 == NULL ) { include_once ‘jpgraph_gb2312.php’ ; $this->g2312 = new GB2312toUTF8(); } return $this->g2312->gb2utf8($aTxt); */ return $aTxt; //直接return }

如果提示這個,那么你可以點擊這里下載字體simhei.ttf然后保存到jpgraph文件夾的fonts下即可解決問題!
PS:所有文件代碼點擊下載