可共享链接
zip文件
$config = [
'type' => 'anyone',
'role' => 'reader',
'withLink' => true,
//'allowFileDiscovery' => false
];
$tempPermission = new Google_Service_Drive_Permission($config);
$ret = $this->service->permissions->create($file, $tempPermission);
echo '<pre>';
print_r($ret);
$files = $this->service->files->get($file);
print_R($files);
这是设置perm后file对象的输出:
Google_Service_Drive_DriveFile Object
(
[collection_key:protected] => spaces
[appProperties] =>
[capabilitiesType:protected] => Google_Service_Drive_DriveFileCapabilities
[capabilitiesDataType:protected] =>
[contentHintsType:protected] => Google_Service_Drive_DriveFileContentHints
[contentHintsDataType:protected] =>
[copyRequiresWriterPermission] =>
[createdTime] =>
[description] =>
[driveId] =>
[explicitlyTrashed] =>
[exportLinks] =>
[fileExtension] =>
[folderColorRgb] =>
[fullFileExtension] =>
[hasAugmentedPermissions] =>
[hasThumbnail] =>
[headRevisionId] =>
[iconLink] =>
[id] => 1CU_nTm06ATlf2s54890oY62NyEzCGgyf
[imageMediaMetadataType:protected] => Google_Service_Drive_DriveFileImageMediaMetadata
[imageMediaMetadataDataType:protected] =>
[isAppAuthorized] =>
[kind] => drive#file
[lastModifyingUserType:protected] => Google_Service_Drive_User
[lastModifyingUserDataType:protected] =>
[md5Checksum] =>
[mimeType] => application/zip
[modifiedByMe] =>
[modifiedByMeTime] =>
[modifiedTime] =>
[name] => restorepoint_2019_08_02_07_32_57.zip
[originalFilename] =>
[ownedByMe] =>
[ownersType:protected] => Google_Service_Drive_User
[ownersDataType:protected] => array
[parents] =>
[permissionIds] =>
[permissionsType:protected] => Google_Service_Drive_Permission
[permissionsDataType:protected] => array
[properties] =>
[quotaBytesUsed] =>
[shared] =>
[sharedWithMeTime] =>
[sharingUserType:protected] => Google_Service_Drive_User
[sharingUserDataType:protected] =>
[size] =>
[spaces] =>
[starred] =>
[teamDriveId] =>
[thumbnailLink] =>
[thumbnailVersion] =>
[trashed] =>
[trashedTime] =>
[trashingUserType:protected] => Google_Service_Drive_User
[trashingUserDataType:protected] =>
[version] =>
[videoMediaMetadataType:protected] => Google_Service_Drive_DriveFileVideoMediaMetadata
[videoMediaMetadataDataType:protected] =>
[viewedByMe] =>
[viewedByMeTime] =>
[viewersCanCopyContent] =>
[webContentLink] =>
[webViewLink] =>
[writersCanShare] =>
[internal_gapi_mappings:protected] => Array
(
)
[modelData:protected] => Array
(
)
[processed:protected] => Array
(
)
)
如果有人能弄清楚如何设置权限,并且从生成之日起一小时内过期(在文档中找不到任何有关此内容的信息),则可获得加分
关于php客户端
).