0

我确实知道前两个帖子:

但是除了回答“你确定你使用的是最新版本吗”之外,没有一个提问者回来说是或否,或者他们是否设法找到了答案。

因为我和他们做同样的事情,所以我使用的是最新的 apiDriveService.php,最后一次修订是 2012 年 6 月。

正确找到了数据,但是当您到达插入行时,显然会发生错误。

而且我不明白为什么对于 SDK php 示例,它似乎是正确的。

这是 Google Api 控制台中的问题吗?还是我需要将数据编码为特殊的东西?

编辑:在 apiDriveService 文件中,我可以看到这一行:

$this->files = new FilesServiceResource($this, $this->serviceName, 'files', json_decode('{"methods": {
"insert": {"scopes": ["https://www.googleapis.com/auth/drive", "https://www.googleapis.com/auth/drive.file"],
"parameters": {"convert": {"default": "false", "type": "boolean", "location": "query"}, "targetLanguage": {"type": "string", "location": "query"}, "sourceLanguage": {"type": "string", "location": "query"}, "ocrLanguage": {"type": "string", "location": "query"}, "pinned": {"default": "false", "type": "boolean", "location": "query"}, "ocr": {"default": "false", "type": "boolean", "location": "query"}, "timedTextTrackName": {"type": "string", "location": "query"}, "timedTextLanguage": {"type": "string", "location": "query"}}, "supportsMediaUpload": true, "request": {"$ref": "File"}, "mediaUpload": {"maxSize": "10GB", "accept": ["*/*"], "protocols": {"simple": {"path": "/upload/drive/v2/files", "multipart": true}, "resumable": {"path": "/resumable/upload/drive/v2/files", "multipart": true}}}, "id": "drive.files.insert", "httpMethod": "POST", "path": "files", "response": {"$ref": "File"}}, ...);

在我发送的参数中,有data 和 mimetype

$created = $apiService->files->insert($driveFile, array('data' => $data,'mimeType' => $mimeType));

在插入函数中,有一个带有数据和 mimetype 的 array_merge:

public function insert(DriveFile $postBody, $optParams = array()) {
  $params = array('postBody' => $postBody);
  $params = array_merge($params, $optParams);
  $data = $this->__call('insert', array($params));
  if ($this->useObjects()) {
    return new DriveFile($data);
  } else {
    return $data;
  }
}

我在上面提到的行的插入部分没有找到它们。它与此有关吗?

4

1 回答 1

1

只需查看来自 Google SVN 的当前 API 客户端。 http://code.google.com/p/google-api-php-client/source/checkout 我们遇到了同样的问题,但是在进行 svn 结帐后,它神奇地起作用了,感谢 Alain 和 Claudio 对此的迅速反应.

于 2012-08-02T21:34:17.457 回答