循环浏览Firebase快照并使用PHP获取值

循环浏览Firebase快照并使用PHP获取值,php,firebase,firebase-realtime-database,Php,Firebase,Firebase Realtime Database,我一直在寻找关于这个问题的文档,但到目前为止运气不佳。这就是我所拥有的: $firebase = (new Factory) ->withServiceAccount($serviceAccount) ->withDatabaseUri('https://mydomain.firebaseio.com/') ->create(); $db = $firebase->getDatabase(); $db->getReference('cars') ->ord

我一直在寻找关于这个问题的文档,但到目前为止运气不佳。这就是我所拥有的:

$firebase = (new Factory)
->withServiceAccount($serviceAccount)
->withDatabaseUri('https://mydomain.firebaseio.com/')
->create();

$db = $firebase->getDatabase();

$db->getReference('cars')
->orderByChild('brand')
->equalTo('volvo')
->limitToLast(10)
->getSnapshot();

...

现在,如何循环数据并从快照中获取值?

这是如何从快照/引用中获取值:

$firebase = (new Factory)
->withServiceAccount($serviceAccount)
->withDatabaseUri('https://mydomain.firebaseio.com/')
->create();

$db = $firebase->getDatabase();

$ref->getReference('cars')->orderByChild('brand')->equalTo('volvo')->limitToLast(10);

$values = $ref->getValue();

...