问题描述
我在FTP服务器上使用Google Spreadsheet API时遇到了3天的问题。 OVH serv不允许安装Composer,因此,我尝试在没有此工具的情况下进行安装。 我尝试了几种方法,但到目前为止,它们均无法正常工作:
// since x is declared as `Bar<ThatWay>`,we can only ever use the `ThatWay` implementation of `apply`/`test`
let x: Bar<ThatWay> = Bar::new(vec![1,2,3]);
x.test(); // -> Method: [3,4,5]
- 并尝试像这样在我的script.PHP中调用Google Api:
function google_api_PHP_client_autoload($className){
$classpath = explode('_',$className);
if ($classpath[0] != 'Google') {
return;
}
// Drop 'Google',and maximum class file path depth in this project is 3.
$classpath = array_slice($classpath,1,2);
$filePath = dirname(__FILE__) . '/' . implode('/',$classpath) . '.PHP';
if (file_exists($filePath)) {
require_once($filePath);
}
}
spl_autoload_register('google_api_PHP_client_autoload');
?>
- 或者也这样:
<?PHP
define('DOCROOT',dirname(__FILE__));
use Spreadsheet\DefaultServiceRequest;
use Spreadsheet\ServiceRequestFactory;
if(!function_exists('classAutoLoader')){
function classAutoLoader($class_name) {
$class_name = str_replace('\\','/',$class_name);
require_once(DOCROOT."/src/".$class_name.".PHP");
}
}
spl_autoload_register('classAutoLoader');
- 我正在尝试使用 Google Spreadsheet API 进行这些API调用
require __DIR__ . '/vendor/autoload.PHP';
- 我还添加了正在使用的 json文件( composer.json,composer.lock和凭据.json )我的ROOT文件夹中的Composer(在本地运行良好)。
- 除此之外,我尝试使其与其他Google库一起使用,例如 googleapis-master 和 google-api-PHP-client-2.8.1
$client = new Google_Client();
$client->setApplicationName('Google Sheets API PHP');
$client->setScopes(Google_Service_Sheets::SPREADSHEETS);
$client->setAuthConfig('credentials.json');
$client->setAccesstype('offline');
$service = new Google_Service_Sheets($client);
$spreadsheetId = "1LLpSUVBAA3dSiyOG4lKDHDxqeldazzdads";
我确定我在使用这些东西时会丢失一些东西,但是如果有人可以向我解释如何在没有Composer的情况下使其正常工作,我将不胜感激。
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)