小编Map*_*rup的帖子

如何在google drive v3 PHP中更新文件

我似乎无法使用以下代码更新谷歌驱动器中的文件,一切正常但文件保持不变?我正在使用v3 api.

 function updateFile($service, $fileId, $data) {
        try {
            $emptyFile = new Google_Service_Drive_DriveFile();
            $file = $service->files->get($fileId);
            $service->files->update($fileId, $emptyFile, array(
                'data' => $data,
                'mimeType' => 'text/csv',
                'uploadType' => 'multipart'
            ));
        } catch (Exception $e) {
            print "An error occurred: " . $e->getMessage();
        }
    }
Run Code Online (Sandbox Code Playgroud)

php google-api google-drive-api google-api-php-client

8
推荐指数
1
解决办法
3000
查看次数