将google api客户端添加到codeigniter [英] Adding google api client to codeigniter
问题描述
我想使用php在codeigniter中上传文件到谷歌驱动器。首先,我试图整合google api客户端到codiginator。
I want to upload files to google drive using php in codeigniter. First of all i am trying to integrate google api client to codiginator.
我已经将所有的文件上传到我的third_party文件夹。
看起来像这样
I have uploaded all the files in to my third_party folder. it look like this
我在库中创建了一个名为
资料夹 google.php
的文件
I i have created a file called google.php
inside my libraries
folder
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();
}
}
?>
然后我在我的家庭控制器中加载这个库
Then i loaded the library in my home controller like this
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库后,家庭控制器在工作中。每一件事都显示一个空白页。
After loading the google library none of the functions inside home controllers are working. Every thing just shows a blank page.
而在家庭控制器中有一个函数'test_lib'
And Inside the home controller i have a function 'test_lib'
function test_lib(){
echo $this->google->getLibraryVersion();
}
当我加载页面。我得到一个黑页没有错误或显示。
When i load the page . i get a black page no errors or showing.
有人可以帮助我添加google api客户端库到codeigniter。 Tnx。
Can someone help me to add the google api client library to codeigniter. Tnx.
推荐答案
正如我已经提到的,在仓库中有以下例子:
Google / autoload .php
应该包含在
之前,使用类/实例化对象。在你的情况下,它是 APPPATH。 'third_party / Google / autoload.php'
文件。
As I mentioned already, following examples in repository,
Google/autoload.php
should be included before
using classes/instantiating objects. In your case it is APPPATH . 'third_party/Google/autoload.php'
file.
这篇关于将google api客户端添加到codeigniter的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!