开发者

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?

How to iterate through the response of this API request in Laravel 9

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜