1

我将在我的网络项目中使用JpGraph 。为此,我将库下载到我的项目文件夹中并创建了以下测试代码:

        <?php
        include ( "jpgraph-3.5.0b1/src/jpgraph.php");
        include ("jpgraph-3.5.0b1/src/jpgraph_gantt.php");

        // A new graph with automatic size
        $graph = new GanttGraph (0,0, "auto");

        //  A new activity on row '0'
        $activity = new GanttBar (0,"Project", "2001-12-21", "2002-02-20");
        $graph->Add( $activity);

        // Display the Gantt chart
        $graph->Stroke();
        ?> 

错误信息是:

The image “http://localhost:10088/test/check.php” cannot be displayed, 
because it contains errors.

我的代码有什么问题?事实上,它只是从这里复制而来的。我唯一改变的是 JpGraph 库的路径。那么,我是否需要以某种特殊的方式将这个库导入我的项目中(到目前为止,我刚刚将 JpGraph 的文件夹复制到了项目的文件夹中)?我正在使用 Zend Studio。

4

1 回答 1

1

这可能是由页面上的额外空白引起的。<?php确保在开始标记之前没有任何空格或换行符。

于 2012-05-07T12:23:05.050 回答