【问题标题】:Google Drive listChildren Stopped working谷歌云端硬盘列表儿童停止工作
【发布时间】:2014-04-12 13:15:23
【问题描述】:

我有一个小 php 脚本,它应该从谷歌驱动器获取文件。它已经工作了几个月,突然停止了。 listChildren() 方法返回一个带有空 items 数组的对象:

object(Google_ChildList)#2 (8) {
  ["etag"]=>
  string(57) ""ft0vWwGLra-c-cl2j_y_UrVn1UQ/vyGp6PvFo4RvsFtPoIWeCReyIC8""
  ["__itemsType":protected]=>
  string(21) "Google_ChildReference"
  ["__itemsDataType":protected]=>
  string(5) "array"
  ["items"]=>
  array(0) {
  }
  ["kind"]=>
  string(15) "drive#childList"
  ["nextLink"]=>
  NULL
  ["nextPageToken"]=>
  NULL
  ["selfLink"]=>
  string(79) "https://www.googleapis.com/drive/v2/files/0BwwPoJj-4FnGTjBScFJ1XzRycE0/children"
}

当我在 APIs Explorer 中输入文件夹的 ID 时:https://developers.google.com/drive/v2/reference/children/list 我得到了正确的列表。

发生了什么?我认为我没有改变任何东西。

【问题讨论】:

  • 你能发布一些代码吗?
  • 所以我找到了一个有类似问题的人,他的问题是他没有与他的服务帐户共享该文件夹。我的文件夹是公用文件夹,所以我认为我不需要这样做,但无奈之下,我尝试了。有效!然后,为了测试,我取消共享服务帐户,代码仍然有效。因此,尽管看起来不太可能,但我只能得出结论,Google Drive API 存在某种问题,通过重新保存文件夹权限已修复。也许这不是我的错:blog.codinghorror.com/…

标签: php google-api google-drive-api google-api-php-client


【解决方案1】:

使用此代码:

$service->files->listFiles(array('q' => "'<FOLDER_ID>' in parents"));

Error on list files using folderId

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多