我正在使用在http://code.google.com/apis/chart/docs/post_requests.html上給出的PHP發佈請求示例來生成圖表。谷歌圖表工具示例不工作
代碼: chartserver-image.php
<?php
// Create some random text-encoded data for a line chart.
header('content-type: image/png');
$url = 'http://chart.apis.google.com/chart';
$chd = 't:';
for ($i = 0; $i < 150; ++$i) {
$data = rand(0, 100000);
$chd .= $data . ',';
}
$chd = substr($chd, 0, -1);
// Add data, chart type, chart size, and scale to params.
$chart = array(
'cht' => 'lc',
'chs' => '600x200',
'chds' => '0,100000',
'chd' => $chd);
// Send the request, and print out the returned bytes.
$context = stream_context_create(
array('http' => array(
'method' => 'POST',
'content' => http_build_query($chart))));
fpassthru(fopen($url, 'r', false, $context));
?>
another_page.html
<img width='600' height='200' src='chartserver-image.php'>
現在,當我訪問another_page.html,圖像不會當我在視圖中單擊加載它顯示的圖像
圖像「http://localhost/demo/chartserver-image.php」無法顯示,因爲它包含錯誤。
我無法理解的問題是什麼?
請幫我在這
感謝
+1似乎已經解決了我的問題在http://stackoverflow.com/questions/3682622/anyone-having-problems-with-google-charts-in-xampp – Mawg 2010-09-10 08:08:51
哎呀,對不起,不,它沒有 - 一些東西別的,對不起。但無論如何,這是一個好點 – Mawg 2010-09-10 10:22:23