firebase php sdk不支持多筛选器数据
我一直使用PHPSDK在firebase中使用多过滤器数据firebase php sdk不支持多筛选器数据,php,firebase,filter,Php,Firebase,Filter,我一直使用PHPSDK在firebase中使用多过滤器数据 $serviceAccount = ServiceAccount::fromJsonFile(__DIR__ . self::SECRET_FILE); $firebase = (new Factory) ->withServiceAccount($serviceAccount) ->withDatabaseUri(self::DATABASE_URL) ->create(); $da
$serviceAccount = ServiceAccount::fromJsonFile(__DIR__ . self::SECRET_FILE);
$firebase = (new Factory)
->withServiceAccount($serviceAccount)
->withDatabaseUri(self::DATABASE_URL)
->create();
$database = $firebase->getDatabase();
$values = $database->getReference('users')
->orderByChild('email')->equalTo('test@test.com')
->orderByChild('is_active')->equalTo('1')
->getValue();
echo "<pre>";
print_r($values);die();
$serviceAccount=serviceAccount::fromJsonFile(\uuu DIR\uuuu.self::SECRET\u文件);
$firebase=(新工厂)
->withServiceAccount($serviceAccount)
->withDatabaseUri(self::DATABASE\uURL)
->创建();
$database=$firebase->getDatabase();
$values=$database->getReference('users'))
->orderByChild('email')->equalTo('test@test.com')
->orderByChild('is_active')->equalTo('1')
->getValue();
回声“;
打印(价值);模具();
在这里,我使用了两次orderByChild,因此它抛出了错误
Kreait\Firebase\Exception\Database\UnsupportedQuery:此查询已排序。在第288行的C:\wamp64\www\firebase diem\vendor\kreait\firebase php\src\firebase\Database\Query.php中
你能建议我firebase php sdk支持多过滤器吗?如果是,如何解决上述错误?这不是PHP SDK(或任何其他Firebase SDK)的限制-实时数据库查询仅支持按一维排序。SDK只会使您免于发出请求并获得错误或意外结果
如果需要按多个维度排序,则必须在(PHP)代码中进行排序,或者在数据库中创建一个可以按其排序的复合键/字段
例如,您可以通过引入一个新字段来实现后者,其中的值为active\u
或inactive\u
按此字段升序进行查询将首先显示按电子邮件排序的活动用户,然后是按电子邮件排序的非活动用户
按此字段降序查询将首先显示按电子邮件排序的非活动用户,然后显示按电子邮件排序的活动用户。hi您能为这个问题提供帮助吗?