How to iterate through the response of this API request in Laravel 9
I'v开发者_StackOverflowe got this thing which I don't know what it is, an object, a collection... that I am trying to parse. It's the output of below code (response of an Uploadcare PHP API request):
$fileListResponse = $api->file()->listFiles();
$fileCollection = $fileListResponse->getResults();
As you can see in the screenshot below the children are -inner
, -api
and #elements
. The children of the nodes of #elements
also have -api
and -inner
.
When I try the following:
foreach ($fileCollection->elements as $thing) {
...
}
I get the error:
Cannot access protected property Uploadcare\FileCollection::$elements
How can I iterate through the elements?
精彩评论