Google drive api 如何在php中使用Google Drive API v3共享文件?

Google drive api 如何在php中使用Google Drive API v3共享文件?,google-drive-api,Google Drive Api,如何在Google Drive API v3中共享文件?我列出了文件列表,我想添加与Laravel的共享功能?如果您是指与其他用户共享文件,则可以执行以下操作 client = new Google_Client(); // setup the client the way you do // .... service = new Google_Service_Drive(client) $role = 'writer'; $userEmail = 'user@gmail.com'; $fil

如何在Google Drive API v3中共享文件?我列出了文件列表,我想添加与Laravel的共享功能?

如果您是指与其他用户共享文件,则可以执行以下操作

client = new Google_Client();
// setup the client the way you do
// ....

service = new Google_Service_Drive(client)
$role = 'writer';
$userEmail = 'user@gmail.com';
$fileId = 'The ID of the file to be shared';

$userPermission = new Google_Service_Drive_Permission(array(
  'type' => 'user',
  'role' => $role,
  'emailAddress' => $userEmail
));

$request = $service->permissions->create(
  $fileId, $userPermission, array('fields' => 'id')
);
参考:

查看我的git回购,以获得更多有用的示例

如果您的意思是与其他用户共享文件,则可以执行以下操作

client = new Google_Client();
// setup the client the way you do
// ....

service = new Google_Service_Drive(client)
$role = 'writer';
$userEmail = 'user@gmail.com';
$fileId = 'The ID of the file to be shared';

$userPermission = new Google_Service_Drive_Permission(array(
  'type' => 'user',
  'role' => $role,
  'emailAddress' => $userEmail
));

$request = $service->permissions->create(
  $fileId, $userPermission, array('fields' => 'id')
);
参考:

查看我的git回购,以获得更多有用的示例

我找不到任何代码示例?你能帮我吗?请花点时间阅读帮助页面,尤其是名为和的部分。更重要的是,请阅读。您可能还想了解。我找不到任何代码示例?您能帮我吗?请花一些时间阅读帮助页面,特别是名为和的部分。更重要的是,请阅读。您可能还想了解。是否仍然可以通过权限禁用下载?是否仍然可以通过权限禁用下载?