【发布时间】:2016-10-15 23:04:53
【问题描述】:
使用 var_export 函数后我有这样的数据
Google_Service_Drive_FileList::__set_state(array(
'collection_key' => 'items',
'internal_gapi_mappings' => array() ,
'etag' => NULL,
'itemsType' => 'Google_Service_Drive_DriveFile',
'itemsDataType' => 'array',
'kind' => NULL,
'nextLink' => NULL,
'nextPageToken' => NULL,
'selfLink' => NULL,
'modelData' => array(
'items' => array(
0 => array(
'id' => '1dOiZFO6nFEYKSLnMRS9mKZPXFBjztg_BwgEmNOPC2tQ',
'title' => 'Php zend download',
)
) ,
) ,
'processed' => array() ,
))
我如何从中获取数据。
我正在尝试将其存储在变量$response
print_r($response->modelData['items']['0']['id']);
但一无所获。
【问题讨论】:
-
现在我尝试了
print_r($response['0']['modelData']['items']['0']['id']);并得到了Notice: Undefined index: items -
minimal reproducible example?
$response是从哪里来的?当您尝试print_r ($response)时会发生什么? -
$response来自文件列表api的响应
标签: php arrays object multidimensional-array