Roh*_*hit 9 php codeigniter google-api-php-client
当我使用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
Run Code Online (Sandbox Code Playgroud)
Gau*_*pta 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();
}
}
Run Code Online (Sandbox Code Playgroud)
然后使用:
$this->load->library('google');
echo $this->google->getLibraryVersion();
Run Code Online (Sandbox Code Playgroud)
您可以更改为库路径,需要 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);
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
3345 次 |
| 最近记录: |