【问题标题】:Google Drive Api - google-apps.document - get modifiedTimeGoogle Drive Api - google-apps.document - 获取修改时间
【发布时间】:2016-12-23 12:30:16
【问题描述】:

我将 Google Drive Api v3 与 PHP 一起使用。我有一个 Google 文档 - application/vnd.google-apps.document。

如何获得上次修改时间?

我试过了:

$this->getClient()->files->get($id,[]);

并把所有细节都清空,如何获得最后更新日期?

 Google_Service_Drive_DriveFile {#1362 ▼
    #collection_key: "spaces"
    +appProperties: null
    #capabilitiesType: "Google_Service_Drive_DriveFileCapabilities"
    #capabilitiesDataType: ""
    #contentHintsType: "Google_Service_Drive_DriveFileContentHints"
    #contentHintsDataType: ""
    +createdTime: null
    +description: null
    +explicitlyTrashed: null
    +fileExtension: null
    +folderColorRgb: null
    +fullFileExtension: null
    +headRevisionId: null
    +iconLink: null
    +id: "1WoKgfNSFN1sIDqbLNahTMe4Ds8rNygt2E8AkUcbO1qM"
    #imageMediaMetadataType: "Google_Service_Drive_DriveFileImageMediaMetadata"
    #imageMediaMetadataDataType: ""
    +isAppAuthorized: null
    +kind: "drive#file"
    #lastModifyingUserType: "Google_Service_Drive_User"
    #lastModifyingUserDataType: ""
    +md5Checksum: null
    +mimeType: "application/vnd.google-apps.document"
    +modifiedByMeTime: null
    +modifiedTime: null
    +name: "+ 4.4 Szkolenia żeglarskie, REJSY SZKOLENIOWE"
    +originalFilename: null
    +ownedByMe: null
    #ownersType: "Google_Service_Drive_User"
    #ownersDataType: "array"
    +parents: null
    #permissionsType: "Google_Service_Drive_Permission"
    #permissionsDataType: "array"
    +properties: null
    +quotaBytesUsed: null
    +shared: null
    +sharedWithMeTime: null
    #sharingUserType: "Google_Service_Drive_User"
    #sharingUserDataType: ""
    +size: null
    +spaces: null
    +starred: null
    +thumbnailLink: null
    +trashed: null
    +version: null
    #videoMediaMetadataType: "Google_Service_Drive_DriveFileVideoMediaMetadata"
    #videoMediaMetadataDataType: ""
    +viewedByMe: null
    +viewedByMeTime: null
    +viewersCanCopyContent: null
    +webContentLink: null
    +webViewLink: null
    +writersCanShare: null
    #internal_gapi_mappings: []
    #modelData: []
    #processed: []
  }

还有其他方法可以得到这个日期吗?

【问题讨论】:

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


【解决方案1】:

你应该指定你需要的字段,试试这个

$response = $this->service->files->get($fileId, array(
  'fields' => 'id, name, modifiedTime',
  // uncomment the following if you are working with team drive
  //'supportsTeamDrives' => true
));
print_r($response);

我希望这会有所帮助

查看我的 git 存储库,了解一些有用的功能 https://github.com/sazaamout/gDrive/blob/master/gDrive.php

查看以下链接以获取更多信息 https://developers.google.com/drive/v3/web/search-parameters#file_fields

【讨论】:

    猜你喜欢
    • 2016-06-16
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2017-12-14
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多