当我使用APPPATH。' libraries / Google / Client.php'时,所有包含在require_once中的文件,即子文件,即(Auth / AssertionCredentials.php)
A PHP Error was encountered
Severity: Warning
Message: require_once(Google/Auth/AssertionCredentials.php): failed to open stream: No such file or directory
Filename: Google/Client.php
Line Number: 18
答案 0 :(得分:15)
复制" Google"文件夹到third_party。
在名为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();
}
}
然后使用:
$this->load->library('google');
echo $this->google->getLibraryVersion();
答案 1 :(得分:2)
您可以更改为库路径,需要google客户端,然后切换回CI默认路径..
// change directory to libraries path
chdir(APPPATH.'libraries');
// include API
require_once('Google/Client.php');
// do some stuff here with the Google API
// switch back to CI default path
chdir(FCPATH);