我想使用Codeigniter中的php将文件上传到Google驱动器。首先,我正在尝试将Google api客户端集成到codiginator。
我已将所有文件上传到我的third_party文件夹中。它看起来像这样
我我已经创建了一个名为google.php
我里面libraries
的文件夹
google.php文件
<?php
if (!defined('BASEPATH')) exit('No direct script access allowed');
set_include_path(APPPATH . 'third_party/' . PATH_SEPARATOR . get_include_path());
require_once APPPATH . 'third_party/Google/Client.php';
class Google extends Google_Client {
function __construct($params = array()) {
parent::__construct();
}
}
?>
然后我像这样将库加载到我的家庭控制器中
function __construct() {
parent::__construct();
//session, url, satabase is set in auto load in the config
$this->load->model('Home_model', 'home');
$this->load->library('pagination');
$this->load->library('google');
}
加载Google库后,家庭控制器内部的所有功能均无法正常工作。每件事都只显示一个空白页。
在家庭控制器内部,我有一个函数“ test_lib”
function test_lib(){
echo $this->google->getLibraryVersion();
}
当我加载页面。我得到一张黑页,没有错误或显示。
有人可以帮我将Google api客户端库添加到codeigniter。Tnx。
正如我已经提到的,Google/autoload.php
在使用类/实例化对象之前,应包括存储库中的以下示例。您的情况是APPPATH . 'third_party/Google/autoload.php'
文件。
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句