你好朋友我的问题很简单但很难理解我想是的。
这是更多代码:-
$graph1 = new gapi($ga_email,$ga_password);
$dimensions = array('date');
$metrics = array('visits');
$graph1->requestReportData($ga_profile_id,
$dimensions,
$metrics,
'date'
);
$graph2 = new gapi($ga_email,$ga_password);
$dimensions = array('date');
$metrics = array('visits');
$graph2->requestReportData($ga_profile_id,
$dimensions,
$metrics,
'date',
$filter, // Filter the data
'2012-09-07', // Start Date
'2012-10-07', // End Date
1, // Start Index
500 // Max results
);
我有一个数组可以说
$resultsg1 = $graph1->getResults();
和
$resultsg2 = $graph2->getResults();
我试图从每个循环代码中获取这个值是here
data.addRows([
<?php
foreach($results as $result)
{
echo '["'.date("l, F j, Y",strtotime($result->getDate())).'", '.$result->getVisits().'," Visits :'.$result->getVisits().'","'.date("l, F j, Y",strtotime($result->getDate())).'",'.$result->getVisits().'," Visits :'.$result->getVisits().'"],';
}
?>
]);
现在我的问题我需要这样的输出:-
foreach($resultsg1 as $result1 and resultsg2 as $results2 )
{
echo '["'.date("l, F j, Y",strtotime($result1->getDate())).'", '.$result1->getVisits().'," Visits :'.$result1->getVisits().'","'.date("l, F j, Y",strtotime($result2->getDate())).'",'.$result2->getVisits().'," Visits :'.$result2->getVisits().'"],';
}
?>
]);
任何帮助都非常感谢.... :)
注意:- 此代码的目的是简单地创建一个包含两个不同月份的图表。