jpgraph中出错" 图像因其本身有错无法显示"
Jun 13, 2016 am 11:55 AM
jpgraph中报错" 图像因其本身有错无法显示"
因为中文乱码的问题,我加了一行设置中文字体的语句$graph->title->SetFont(FF_SIMSUN,FS_BOLD,14);
但是加上后就报错图像因其本身有错无法显示
如果去掉这句,或者将中文改成英文就没有问题
查了网上说要加一句ob_clean();清除之前的输出,但是不知道加在哪里?求前辈指点。
下面是代码
<br /><?php <br />require_once ('jpgraph/jpgraph.php');<br />require_once ('jpgraph/jpgraph_bar.php');<br /><br />$datay1=array(13,8,19,7,17,6);<br />$datay2=array(4,5,2,7,5,25);<br /><br />// Create the graph.<br />$graph = new Graph(350,250);<br />$graph->SetScale('textlin');<br />$graph->SetMarginColor('silver');<br /><br />// Setup title<br />$graph->title->Set('支持布什的人数统计(万)');<br />$graph->title->SetFont(FF_SIMSUN,FS_BOLD,14);<br /><br />// Create the first bar<br />$bplot = new BarPlot($datay1);<br />$bplot->SetFillGradient('AntiqueWhite2','AntiqueWhite4:0.8',GRAD_VERT);<br />$bplot->SetColor('darkred');<br /><br />// Create the second bar<br />$bplot2 = new BarPlot($datay2);<br />$bplot2->SetFillGradient('olivedrab1','olivedrab4',GRAD_VERT);<br />$bplot2->SetColor('darkgreen');<br /><br />// And join them in an accumulated bar<br />$accbplot = new AccBarPlot(array($bplot,$bplot2));<br />$graph->Add($accbplot);<br /><br />ob_clean();<br />$graph->Stroke();<br /><br />?><br /><br />
------解决方案--------------------
将中文改成英文就没有问题
显然你的中文字库设置有误
------解决方案--------------------
1.字体是否存在,名字是否相同->FF_SIMSUN 是个常量,所以要检视其具体值和你的系统是否相符
2.编码

Article chaud

Outils chauds Tags

Article chaud

Tags d'article chaud

Bloc-notes++7.3.1
Éditeur de code facile à utiliser et gratuit

SublimeText3 version chinoise
Version chinoise, très simple à utiliser

Envoyer Studio 13.0.1
Puissant environnement de développement intégré PHP

Dreamweaver CS6
Outils de développement Web visuel

SublimeText3 version Mac
Logiciel d'édition de code au niveau de Dieu (SublimeText3)

Sujets chauds

Solution : Votre organisation vous demande de modifier votre code PIN

Comment ajuster les paramètres de bordure de fenêtre sous Windows 11 : modifier la couleur et la taille

Comment changer la couleur de la barre de titre sous Windows 11 ?

Comment activer ou désactiver les aperçus miniatures de la barre des tâches sur Windows 11

Problèmes d'erreur OOBELANGUAGE dans la réparation de Windows 11/10

Quelles sont les différences entre Huawei GT3 Pro et GT4 ?

Afficher le guide de mise à l'échelle sur Windows 11

10 façons de régler la luminosité sous Windows 11
