我有以下对象:
object(Google_Service_Analytics_McfData)#35 (23) {
["collection_key":protected]=>
string(4) "rows"
["internal_gapi_mappings":protected]=>
array(0) {
}
["columnHeadersType":protected]=>
string(45) "Google_Service_Analytics_McfDataColumnHeaders"
["columnHeadersDataType":protected]=>
string(5) "array"
["containsSampledData"]=>
bool(false)
["id"]=>
string(248) "https://www.googleapis.com/analytics/v3/data/mcf?ids=ga:xxxxxxxxx&dimensions=mcf:keyword&metrics=mcf:firstInteractionConversions&filters=mcf:conversionType%3D%3DTransaction;mcf:medium%3D%3Dcpc&start-date=2015-06-01&end-date=2015-08-01&max-results=25"
["itemsPerPage"]=>
int(25)
["kind"]=>
string(17) "analytics#mcfData"
["nextLink"]=>
NULL
["previousLink"]=>
NULL
["profileInfoType":protected]=>
string(43) "Google_Service_Analytics_McfDataProfileInfo"
["profileInfoDataType":protected]=>
string(0) ""
["queryType":protected]=>
string(37) "Google_Service_Analytics_McfDataQuery"
["queryDataType":protected]=>
string(0) ""
["rowsType":protected]=>
string(36) "Google_Service_Analytics_McfDataRows"
["rowsDataType":protected]=>
string(5) "array"
["sampleSize"]=>
NULL
["sampleSpace"]=>
NULL
["selfLink"]=>
string(248) "https://www.googleapis.com/analytics/v3/data/mcf?ids=ga:xxxxxx&dimensions=mcf:keyword&metrics=mcf:firstInteractionConversions&filters=mcf:conversionType%3D%3DTransaction;mcf:medium%3D%3Dcpc&start-date=2015-06-01&end-date=2015-08-01&max-results=25"
["totalResults"]=>
int(18)
["totalsForAllResults"]=>
array(1) {
["mcf:firstInteractionConversions"]=>
string(2) "31"
}
["modelData":protected]=>
array(4) {
["query"]=>
array(8) {
["start-date"]=>
string(10) "2015-06-01"
["end-date"]=>
string(10) "2015-08-01"
["ids"]=>
string(11) "ga:xxxxxxx"
["dimensions"]=>
string(11) "mcf:keyword"
["metrics"]=>
array(1) {
[0]=>
string(31) "mcf:firstInteractionConversions"
}
["filters"]=>
string(47) "mcf:conversionType==Transaction;mcf:medium==cpc"
["start-index"]=>
int(1)
["max-results"]=>
int(25)
}
["profileInfo"]=>
array(6) {
["profileId"]=>
string(8) "xxxxxx"
["accountId"]=>
string(8) "xxxxxxx"
["webPropertyId"]=>
string(13) "UA-xxxxxxx-1"
["internalWebPropertyId"]=>
string(8) "xxxxx"
["profileName"]=>
string(24) "xxxxxxx"
["tableId"]=>
string(12) "mcf:xxxxxxx"
}
["columnHeaders"]=>
array(2) {
[0]=>
array(3) {
["name"]=>
string(11) "mcf:keyword"
["columnType"]=>
string(9) "DIMENSION"
["dataType"]=>
string(6) "STRING"
}
[1]=>
array(3) {
["name"]=>
string(31) "mcf:firstInteractionConversions"
["columnType"]=>
string(6) "METRIC"
["dataType"]=>
string(7) "INTEGER"
}
}
["rows"]=>
array(18) {
[0]=>
array(2) {
[0]=>
array(1) {
["primitiveValue"]=>
string(20) "+create online forms"
}
[1]=>
array(1) {
["primitiveValue"]=>
string(1) "0"
}
}
[1]=>
array(2) {
[0]=>
array(1) {
["primitiveValue"]=>
string(10) "+formstack"
}
[1]=>
array(1) {
["primitiveValue"]=>
string(1) "1"
}
}
[2]=>
array(2) {
[0]=>
array(1) {
["primitiveValue"]=>
string(21) "create a contact form"
}
[1]=>
array(1) {
["primitiveValue"]=>
string(1) "1"
}
}
[3]=>
array(2) {
[0]=>
array(1) {
["primitiveValue"]=>
string(21) "create an online form"
}
[1]=>
array(1) {
["primitiveValue"]=>
string(1) "2"
}
}
[4]=>
array(2) {
[0]=>
array(1) {
["primitiveValue"]=>
string(12) "form builder"
}
[1]=>
array(1) {
["primitiveValue"]=>
string(1) "7"
}
}
[5]=>
array(2) {
[0]=>
array(1) {
["primitiveValue"]=>
string(19) "form builder online"
}
[1]=>
array(1) {
["primitiveValue"]=>
string(1) "1"
}
}
[6]=>
array(2) {
[0]=>
array(1) {
["primitiveValue"]=>
string(13) "form builders"
}
[1]=>
array(1) {
["primitiveValue"]=>
string(1) "0"
}
}
[7]=>
array(2) {
[0]=>
array(1) {
["primitiveValue"]=>
string(12) "form creator"
}
[1]=>
array(1) {
["primitiveValue"]=>
string(1) "1"
}
}
[8]=>
array(2) {
[0]=>
array(1) {
["primitiveValue"]=>
string(19) "form online builder"
}
[1]=>
array(1) {
["primitiveValue"]=>
string(1) "0"
}
}
[9]=>
array(2) {
[0]=>
array(1) {
["primitiveValue"]=>
string(24) "free online form builder"
}
[1]=>
array(1) {
["primitiveValue"]=>
string(1) "1"
}
}
[10]=>
array(2) {
[0]=>
array(1) {
["primitiveValue"]=>
string(25) "free online forms builder"
}
[1]=>
array(1) {
["primitiveValue"]=>
string(1) "1"
}
}
[11]=>
array(2) {
[0]=>
array(1) {
["primitiveValue"]=>
string(19) "online form builder"
}
[1]=>
array(1) {
["primitiveValue"]=>
string(1) "4"
}
}
[12]=>
array(2) {
[0]=>
array(1) {
["primitiveValue"]=>
string(19) "online form creator"
}
[1]=>
array(1) {
["primitiveValue"]=>
string(1) "1"
}
}
[13]=>
array(2) {
[0]=>
array(1) {
["primitiveValue"]=>
string(12) "online forms"
}
[1]=>
array(1) {
["primitiveValue"]=>
string(1) "1"
}
}
[14]=>
array(2) {
[0]=>
array(1) {
["primitiveValue"]=>
string(20) "online forms builder"
}
[1]=>
array(1) {
["primitiveValue"]=>
string(1) "1"
}
}
[15]=>
array(2) {
[0]=>
array(1) {
["primitiveValue"]=>
string(23) "online web form builder"
}
[1]=>
array(1) {
["primitiveValue"]=>
string(1) "1"
}
}
[16]=>
array(2) {
[0]=>
array(1) {
["primitiveValue"]=>
string(25) "patient registration form"
}
[1]=>
array(1) {
["primitiveValue"]=>
string(1) "1"
}
}
[17]=>
array(2) {
[0]=>
array(1) {
["primitiveValue"]=>
string(17) "web forms builder"
}
[1]=>
array(1) {
["primitiveValue"]=>
string(1) "7"
}
}
}
}
["processed":protected]=>
array(0) {
}
}
我希望得到"行"区域,例如显示
+创建在线表单 0
这是我试图用来实现这个目的的代码,但它无法正常工作:
foreach ($response->rows as $row) {
foreach ($row as $cell) {
print_r($cell);
echo $cell;
}
}
有什么想法吗?谢谢。
答案 0 :(得分:1)
您应该对可见性有更多了解:http://php.net/manual/en/language.oop5.visibility.php
声明受保护的成员只能在类本身以及继承和父类中访问。