加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 站长学院 > PHP教程 > 正文

无法从对象php获取parse.com关系

发布时间:2020-12-13 15:58:20 所属栏目:PHP教程 来源:网络整理
导读:我正在使用 PHP parse.com SDK从服务器获取一些数据,但每当我尝试执行$query- find()时都没有任何反应. $historyDB = new ParSEObject('History',$historyId); $relation = $historyDB-getRelation("exams"); $query = $relation-getQuery(); $findQuery = $
我正在使用 PHP parse.com SDK从服务器获取一些数据,但每当我尝试执行$query-> find()时都没有任何反应.

$historyDB = new ParSEObject('History',$historyId);
    $relation = $historyDB->getRelation("exams");
    $query = $relation->getQuery();
    $findQuery = $query->find();

每当我尝试print_r()时,我的$findQuery变量都会显示以下错误:

exception 'ParseParseException' with message 'missing class name' in 
    C:wampwwwparsephp-sdksrcParseParseClient.php:297 Stack trace: #0 
    C:wampwwwparsephp-sdksrcParseParseQuery.php(346):
    ParseParseClient::_request('GET','/1/classes/?whe...',NULL,false) #1
    C:wampwwwreport.php(110): ParseParseQuery->find() #2 {main}

我不知道为什么,
提前致谢.

解决方法

在调用getQuery()之前,应该设置ParseRelation对象的targetClassName属性,尝试通过调用setTargetClass()来设置它.

$historyDB = new ParSEObject('History',$historyId);
$relation  = $historyDB->getRelation("exams");
$relation->setTargetClass('targetClassName');
$query     = $relation->getQuery();
$findQuery = $query->find();

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读