PHP Parse.com查询错误
我不知道你们中有多少人熟悉parse.com平台,但我正在利用他们网站上链接的第三方php库,我遇到了几个问题 链接: 我试图查询我的数据库,但它不断返回PHP Parse.com查询错误,php,api,runtime-error,parse-platform,Php,Api,Runtime Error,Parse Platform,我不知道你们中有多少人熟悉parse.com平台,但我正在利用他们网站上链接的第三方php库,我遇到了几个问题 链接: 我试图查询我的数据库,但它不断返回注意:试图获取非对象的属性。从我所看到的情况来看,我的代码是正确的,但错误源于库中包含的一个文件 以下是我迄今为止的代码: function storeInParseDB ($message, $unit) { $parse = new parseQuery($class = 'PushNotifications'); $pa
注意:试图获取非对象的属性。
从我所看到的情况来看,我的代码是正确的,但错误源于库中包含的一个文件
以下是我迄今为止的代码:
function storeInParseDB ($message, $unit) {
$parse = new parseQuery($class = 'PushNotifications');
$parse->whereEqualTo('unit', $unit);
$result = $parse->find();
echo "RESULT: ";
print_r($result);
}
引发错误的代码:
private function checkResponse($response,$responseCode,$expectedCode){
//TODO: Need to also check for response for a correct result from parse.com
if($responseCode != $expectedCode){
$error = json_decode($response);
$this->throwError($error->error,$error->code);
}
else{
//check for empty return
if($response == '{}'){
return true;
}
else{
return json_decode($response);
}
}
}
任何帮助都将不胜感激。我在克隆后运行以下代码-创建了一个parseConfig.php文件,其中包含自述文件中描述的appid、restkey和masterkey 我在Parse Data Browser中创建了一个新类,其中包含一列string类型的“unit”,并在其中添加了一行unit=test
<?php
include 'parse.com-php-library/parse.php';
function storeInParseDB ($message, $unit) {
$parse = new parseQuery('PushNotifications');
$parse->whereEqualTo('unit', $unit);
$result = $parse->find();
echo "RESULT: ";
print_r($result);
}
storeInParseDB('hi', 'test');
我在克隆后运行以下代码-创建了一个parseConfig.php文件,其中包含自述文件中描述的appid、restkey和masterkey 我在Parse Data Browser中创建了一个新类,其中包含一列string类型的“unit”,并在其中添加了一行unit=test
<?php
include 'parse.com-php-library/parse.php';
function storeInParseDB ($message, $unit) {
$parse = new parseQuery('PushNotifications');
$parse->whereEqualTo('unit', $unit);
$result = $parse->find();
echo "RESULT: ";
print_r($result);
}
storeInParseDB('hi', 'test');
你能指出错误的行吗?第176行是:$this->throwError($error->error,$error->code);我想我在某个地方读到一些东西,说它与json_decode函数有关……如果json_decode返回null,似乎会抛出这个错误。这是因为我在它上面添加了一个print_r($response),它是空的。所以我不知道它是否与XAMPP有关,或者什么……你能指出错误的行吗?第176行是:$this->throwError($error->error,$error->code);我想我在某个地方读到一些东西,说它与json_decode函数有关……如果json_decode返回null,似乎会抛出这个错误。这是因为我在它上面添加了一个print_r($response),它是空的。所以我不知道它是否与XAMPP或其他什么有关……使用MAMP可以很好地工作,但出于某种原因,在使用XAMPP的Windows机器上,json_解码函数会把它搞砸。使用MAMP可以很好地工作,但出于某种原因,在使用XAMPP的Windows机器上,json_解码函数会把它搞砸。