Php 即使启用了GD支持,也无法在本地主机上显示图形

Php 即使启用了GD支持,也无法在本地主机上显示图形,php,mysql,phpgraphlib,Php,Mysql,Phpgraphlib,我试图使用php图形库在本地主机上显示一个简单的图形。我的代码是: include('phpgraphlib.php'); $graph = new PHPGraphLib(650,200); $data = array("1" => .0032, "2" => .0028, "3" => .0021, "4" => .0033, "5" => .0034, "6" => .0031, "7" => .0036, "8" => .0027, "9

我试图使用php图形库在本地主机上显示一个简单的图形。我的代码是:

include('phpgraphlib.php');
$graph = new PHPGraphLib(650,200);
$data = array("1" => .0032, "2" => .0028, "3" => .0021, "4" => .0033, 
"5" => .0034, "6" => .0031, "7" => .0036, "8" => .0027, "9" => .0024, 
"10" => .0021, "11" => .0026, "12" => .0024, "13" => .0036, 
"14" => .0028, "15" => .0025);
$graph->addData($data);
$graph->setTitle('PPM Per Container');
$graph->setBars(false);
$graph->setLine(true);
$graph->setDataPoints(true);
$graph->setDataPointColor('maroon');
$graph->setDataValues(true);
$graph->setDataValueColor('maroon');
$graph->setGoalLine(.0025);
$graph->setGoalLineColor('red');
$graph->createGraph();
但不幸的是,我的屏幕上没有显示任何图形。我已经检查了我对phpinfo的GD支持,它给出了以下结果

GD Support  enabled
GD Version  bundled (2.1.0 compatible)
FreeType Support    enabled
FreeType Linkage    with freetype
FreeType Version    2.4.10
GIF Read Support    enabled
GIF Create Support  enabled
JPEG Support    enabled
libJPEG Version 8
PNG Support enabled
libPNG Version  1.2.50
WBMP Support    enabled
XPM Support enabled
libXpm Version  30411
XBM Support enabled
我的Php版本是5.4.19

我做错了什么?请帮帮我


提前谢谢

同样的事情发生在我身上。。但是在PHP5.5中,它可以完美地工作。。我只是不明白PHP5.4有什么问题。

您的$data数组似乎是数字数组。我建议像这样创建数组,而不是创建关联数组:

$data = array(.0032, .0028, .0021, .0033, .0034, .0031, .0036, .0027,
 .0024, .0021, .0026, .0024, .0036, .0028, .0025);
我在本地机器上运行PHP7.1,由于某些原因,PHPGraphLib不会呈现图形,因为我使用了$data数组的关联数组。PHP5.4.45将使用关联数组渲染图形。这可能与每个版本如何识别或在内部处理关联数组有关