代码如下:
if(extension_loaded("gd")) {
echo "可以使用gd
";
foreach(gd_info() as $cate=>$value)
echo "$cate: $value
";;
}else
echo "‘没安装gd扩展’";
?>
require_once ('jpgraph/jpgraph.php');
require_once ('jpgraph/jpgraph_bar.php');
$datay=array(62,105,85,50);
// Create the graph. These two calls are always required
$graph = new Graph(350,220,'auto');
$graph->SetScale("textlin");
//$theme_class="DefaultTheme";
//$graph->SetTheme(new $theme_class());
// set major and minor tick positions manually
$graph->yaxis->SetTickPositions(array(0,30,60,90,120,150), array(15,45,75,105,135));
$graph->SetBox(false);
//$graph->ygrid->SetColor('gray');
$graph->ygrid->SetFill(false);
$graph->xaxis->SetTickLabels(array('A','B','C','D'));
$graph->yaxis->HideLine(false);
$graph->yaxis->HideTicks(false,false);
// Create the bar plots
$b1plot = new BarPlot($datay);
// ...and add it to the graPH
$graph->Add($b1plot);
$b1plot->SetColor("white");
$b1plot->SetFillGradient("#4B0082","white",GRAD_LEFT_REFLECTION);
$b1plot->SetWidth(45);
$graph->title->Set("Bar Gradient(Left reflection)");
// Display the graph
$graph->Stroke();
?>
结果如下:
可以使用gd
GD Version: bundled (2.0.34 compatible)
FreeType Support: 1
FreeType Linkage: with freetype
T1Lib Support:
GIF Read Support: 1
GIF Create Support: 1
JPEG Support: 1
PNG Support: 1
WBMP Support: 1
XPM Support:
XBM Support: 1
JIS-mapped Japanese Font Support:
Warning: require_once(jpgraph/jpgraph.php): failed to open stream: No such file or directory in C:\Program Files (x86)\EasyPHP-12.1\www\formulaire\reponse_formulaire_systemB_1.php on line 13
Fatal error: require_once(): Failed opening required 'jpgraph/jpgraph.php' (include_path='.;C:\php\pear') in C:\Program Files\ (x86)\EasyPHP-12.1\www\formulaire\reponse_formulaire_systemB_1.php on line 13
因为把jpgraph的文件夹解压缩到easyphp\php\php546里了,所以php.ini没有修改.可是出现了问题,不知道这么回事.如果需要修改php.ini,请问要如何写呢?谢谢各位大神的回答.
把 jpgraph 文件夹的全路径附加到 include_path 后面