我在使用KENDO UI执行控制器时生成错误:Unexpected character in input: '\' (ASCII=92) state=1
生成图表&包含这样的语法:$valueAxis = new \Kendo\Dataviz\UI\ChartValueAxisItem();
我发现它是一个php版本错误,低于5.3的版本不支持命名空间,但我运行PHP 5.4与zend framework 1.12.3&我仍然有这个错误。
控制器:
class StatsController extends Oft_Controller_Action
{
function init ()
{
require_once 'library/Kendo/Autoload.php';
}
public function indexAction(){
$india = new \Kendo\Dataviz\UI\ChartSeriesItem();
$india->name('India')
->data(array(3.907, 7.943, 7.848, 9.284, 9.263, 9.801, 3.890, 8.238, 9.552, 6.855));
$valueAxis = new \Kendo\Dataviz\UI\ChartValueAxisItem();
$valueAxis->labels(array('format' => '{0}%'))
->line(array('visible' => false))
->axisCrossingValue(-10);
$categoryAxis = new \Kendo\Dataviz\UI\ChartCategoryAxisItem();
$categoryAxis->categories(array(2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011))
->majorGridLines(array('visible' => false));
$tooltip = new \Kendo\Dataviz\UI\ChartTooltip();
$tooltip->visible(true)
->format('{0}%')
->template('#= series.name #: #= value #');
$chart = new \Kendo\Dataviz\UI\Chart('chart');
$chart->title(array('text' => 'Gross domestic product growth /GDP annual %/'))
->legend(array('position' => 'bottom'))
->addSeriesItem($india)
->addValueAxisItem($valueAxis)
->addCategoryAxisItem($categoryAxis)
->tooltip($tooltip)
->seriesDefaults(array('type' => 'line'));
echo $chart->render();
}
}
感谢您的帮助
答案 0 :(得分:0)
您的服务器上有哪个版本的PHP?
Kendo UI PHP Wrappers的基本要求是4.3。
试试这个!