本文介绍了在codeiniter中加载google api客户端库的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
首先我在codeigniter框架中将Google文件夹复制到应用程序/ third_party。
first I copied the Google folder to application/third_party in codeigniter framework.
然后google.php在应用程序/库中
then google.php inside the application/libraries
<?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();
}
}
然后我创建了一个名为googleClass.php
and then i have created a controller named googleClass.php
<?php
class GoogleClass extends CI_Controller {
function __construct($params = array()) {
parent::__construct();
}
public function index(){
$this->load->library('google');
echo $this->google->getLibraryVersion();
}
}
但我得到以下错误...
But I get the following error...
Fatal error: require_once(): Failed opening required '' (include_path='application/third_party/;.;C:\xampp\php\pear') in C:\xampp\htdocs\csvinsert\application\third_party\Google\Client.php on line 18
我做错了什么?
推荐答案
尝试这种方式加载你的库: include_once APPPATH。 libraries / third_party / Google / Client.php;
Please try this way load your libraries :include_once APPPATH . "libraries/third_party/Google/Client.php";
这篇关于在codeiniter中加载google api客户端库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!