Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/226.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php 使用Parse查询objectId文件';行不通_Php_Parse Platform - Fatal编程技术网

Php 使用Parse查询objectId文件';行不通

Php 使用Parse查询objectId文件';行不通,php,parse-platform,Php,Parse Platform,我想在数据库中显示一个存储在类“UserPhoto”中的文件,并且我有该文件的objectId 但是,如果我这样做: $image = "objectIdOfTheFile"; $query = new ParseQuery("UserPhoto"); $query->equalTo("objectId",$image); $results = $query->find(); $results实际上返回一个空数组。我查阅了Parse的文档,但没有找到任何建议使用另一种方法的内容。然

我想在数据库中显示一个存储在类“UserPhoto”中的文件,并且我有该文件的objectId

但是,如果我这样做:

$image = "objectIdOfTheFile";
$query = new ParseQuery("UserPhoto");
$query->equalTo("objectId",$image);
$results = $query->find();
$results
实际上返回一个空数组。我查阅了Parse的文档,但没有找到任何建议使用另一种方法的内容。然后,我尝试使用以下方法获取文件URL:

for($i = 0; $i < count($results); $i++)
{
    $imagefile = $results[$i]->getURL();
}
for($i=0;$igetURL();
}
但是由于
$results
是空的
$imagefile
总是空的


奇怪的是,这在JavaScript和Obj-C中都可以使用。任何帮助都将不胜感激

要通过
objectId
获取
ParseObject
,请执行以下操作:


那可能没用。。。但是你能尝试将$image变量转储吗?格式是否正确?即使通过复制+粘贴从数据库中硬编码一个
objectId
,我也会得到object not found错误(当然是周围的)。这可能与用户访问权限有关吗?@Andre或键入错误的对象ID。您可以尝试其他对象吗?我尝试了10个不同的ID,但仍然没有成功。@Andre和对象当前设置为“公共读/写”“在ACL上?不,所以是ACL。但我最好不要公开阅读,但恐怕PHPSDK没有主密钥可供使用,对吗?所以我想我必须。。
$image = "objectIdOfTheFile";
$query = new ParseQuery("UserPhoto");
try {
    $imageObject = $query->get($image);
} catch (ParseException $ex) {
  // The object was not retrieved successfully.
  // error is a ParseException with an error code and message.
}
$date= $object->getCreatedAt();
        $CreatedAt=array();
        foreach($date as $key => $val)
        {
          $CreatedAt[$key] = $val;
        }