有没有办法用PHP在google驱动器上创建一个文件夹?在过去的72小时里,我已经搜索了所有的网络,但是没有结果。你们觉得呢,伙计们?谢谢!
发布于 2019-10-29 23:59:00
下面是使用Google Drive API v3和OAuth访问令牌的更新方法:
$googleClient = new \Google_Client();
$googleClient->setApplicationName('My App');
$googleClient->setAccessToken(env('GOOGLE_OAUTH_ACCESS_TOKEN'));
$googleClient->setClientId(env('GOOGLE_APP_ID'));
$googleClient->setClientSecret(env('GOOGLE_APP_SECRET'));
if ($googleClient->isAccessTokenExpired()) {
$googleClient->fetchAccessTokenWithRefreshToken();
}
$api = new \Google_Service_Drive($client);
$file = new \Google_Service_Drive_DriveFile();
$file->setName('Folder Name');
$file->setMimeType('application/vnd.google-apps.folder');
$folder = $api->files->create($file);它使用Google客户端库
https://stackoverflow.com/questions/11751207
复制相似问题