簡體   English   中英

解析PHP SDK不返回查詢結果

[英]Parse PHP SDK doesn't return query result

我能夠將Parse PHP SDK(版本1.1.2)安裝到我的項目中,並通過快速入門指南成功創建了TestObject。 但是,當我嘗試查詢對象時,它什么也不返回。 我被困住了,不知道從這里去哪里。

use Parse\ParseQuery;

$query = new ParseQuery('TestObject');
$results = $query->find();
foreach($results as $result){
    echo $result->getObjectId() ." - " $result->get("foo") . "\n";
}

您可以這樣嘗試:

$myObj= new ParseObject("TestObject");

$myObj->set("objIdd", 1234);
$myObj->set("objName", "My Name");

try {
  $myObj->save();
  echo 'New object created with objectId: ' . $myObj->getObjectId();
} catch (ParseException $ex) { 
  // Execute any logic that should take place if the save fails.
  // error is a ParseException object with an error code and message.
  echo 'Failed to create new object, with error message: ' + $ex->getMessage();
}

//objectId: "XYZABC", objIdd: 1234, objName: "My Name"

$query = new ParseQuery("TestObject");
try {
  $myObj = $query->get("XYZABC");
  // The object was retrieved successfully.
} catch (ParseException $ex) {
  // The object was not retrieved successfully.
  // error is a ParseException with an error code and message.
}

看一下本指南

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM