我正在为库使用远程 API。
我的数据结构
$graph = new \stdclass;
$graph->width = 500;
$graph->height = 350;
$data1 = array('gross'=>23, 'taxed'=>45, 'discount'=>20, 'revenue'=>32, 'due'=>14);
$data2 = array('gross'=>15, 'taxed'=>23, 'discount'=>23,'revenue'=>12, 'due'=>17);
$data3 = array('gross'=>43, 'taxed'=>23, 'discount'=>34, 'revenue'=>16, 'due'=>20);
$graph->data = array($data1,$data2,$data3);
$graph->setBarColor = array('blue','green','yellow');
$graph->setLegend = 'true';
$graph->setLegendTitle = array('Today','MTD','YTD');
$graph->setTitle = 'Revenue Stats';
$graph->setTitleLocation = 'left';
//JSON encode graph object
$encoded = urlencode(json_encode($graph));
//retrieve XML
$target = 'http://www.ebrueggeman.com/phpgraphlib/api/?g=' . $encoded . '&type=xml';`
错误
(2/2) Exception
String could not be parsed as XML
(1/2) ErrorException
SimpleXMLElement::__construct():
Start tag expected, '<' not found
使用单个数据集可以正常工作,但我无法加载多个数据集。
有什么建议么?