Google Drive PHP API - Simple File Upload(Google Drive PHP API - 简单文件上传)
问题描述
我正在尝试使用 Google Drive PHP API 编写一个小脚本来将本地文件上传到 Google Drive.文档维护得很差,但到目前为止我很确定代码应该是这样的:
I am trying to write a small script to upload a local file to Google Drive, using Google Drive PHP API. The documentation is very poor maintained, but so far I am pretty sure the code should be looking like that:
问题是我无法正确进行身份验证(或者我做错了什么?).我收到的错误是:
The issue is I am not able to do the authentication right (or I am doing something else wrong?). The error I received is:
随后出现此错误:
我做错了什么?您能否提供一个使用 Google Drive PHP API 将文件上传到 Google Drive 的简单工作脚本?提前谢谢!
What am I doing wrong? Can you provide a simple working script of uploading a file to Google Drive using Google Drive PHP API? Thank you in advance!
推荐答案
使用此代码验证并上传测试文件.您需要将 <YOUR_REGISTERED_REDIRECT_URI>
(以及在控制台中)设置到此文档本身以进行身份验证.
Use this code to authenticate and upload a test file. You need to set <YOUR_REGISTERED_REDIRECT_URI>
(and also in console) to this document itself to authenticate.
这篇关于Google Drive PHP API - 简单文件上传的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!