如何在 PHP 中获取与 Google Drive Api 的共享链接

问题描述

我正在使用带有 PHP 的 google drive api。我确实在新创建的文件夹中上传一个文件。但我不知道“如何获得新文件夹的共享 url”。或“我如何为新电子邮件地址授予‘读者’权限”?

我想共享文件夹。不是文件

解决方法

$result = $service->files->create(
    $file,array(
        'data' => file_get_contents($file_path),'mimeType' => 'application/octet-stream',)
);

文件 ID:$fileId = $result['id'];