0
我想顯示里程錶簡單的例子,但它不工作。我的jpg文件在src /目錄中。 Myline圖工作,但爲里程錶哪個文件使用?里程錶jpgraph不能在php
PHP代碼:
<?php
require_once ('/src/jpgraph.php');
require_once ('/src/jpgraph_line.php');
require_once ('jpgraph/jpgraph_odo.php');
// Create a new odometer graph
$graph = new OdoGraph(500,180);
$odo = array();
// Now we need to create an odometer to add to the graph.
for($i=0; $i < 5; ++$i) {
$odo[$i] = new Odometer();
$odo[$i]->SetColor('lightgray:1.9');
$odo[$i]->needle->Set(10+$i*17);
$odo[$i]->needle->SetShadow();
if($i < 2)
$fsize = 10;
else
$fsize = 8;
$odo[$i]->scale->label->SetFont(FF_ARIAL,FS_NORMAL,$fsize);
$odo[$i]->AddIndication(92,100,'red');
$odo[$i]->AddIndication(80,92,'orange');
$odo[$i]->AddIndication(60,80,'yellow');
}
// Create the layout
$row1 = new LayoutHor(array($odo[0],$odo[1]));
$row2 = new LayoutHor(array($odo[2],$odo[3],$odo[4]));
$col1 = new LayoutVert(array($row1,$row2));
// Add the odometer to the graph
$graph->Add($col1);
// ... and finally stroke and stream the image back to the browser
$graph->Stroke();
?>
錯誤:
Fatal error: Class 'OdoGraph' not found in C:\wamp\www\PowerMonitor\odometer.php on line 9
請說明「不能工作」......是否給出錯誤的結果?根本沒有輸出?錯誤代碼? ....? – Simba
沒有給出結果,我正在更新錯誤消息。 – nagi
那麼它明確說明什麼是錯的..它無法找到這個類,這意味着你的'require_once'沒有加載正確,或者你錯過了假設加載這個類的文件 – Gal