您好,我在使用PHP Client Library致电Google Drive API时遇到问题。将文件上传到Google Drive时未定义的变量
我的编码是
$file = new Google_Service_Drive_DriveFile();
$file->setTitle($title);
$result = $service->files->insert($file, array(
'data' => file_get_contents("dd.doc"),
'mimeType' => 'text/plain',
'uploadType' => 'multipart'
));
我得到了以下错误
Undefined variable: service Trying to get property of non-object Call to a member function insert()
哪里$服务初始化的一部分? –
寻求调试帮助的问题(“为什么这个代码不工作?”)必须包含所需的行为,特定的问题或错误以及在问题本身中重现问题所需的最短代码。没有明确问题陈述的问题对其他读者无益。请参阅:如何创建最小,完整和可验证示例。 – DaImTo