【发布时间】:2016-03-31 12:11:04
【问题描述】:
我正在尝试将 google 客户端 api 集成到我的 codeigniter 项目中,并且我已将 google 客户端 api 库放在我的第三方文件夹中。然后制作了一个名为 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();
}
}
?>
然后我将这个库包含在我的主控制器中并尝试访问它,
<?php defined('BASEPATH') OR exit('No direct script access allowed');
class main extends CI_Controller {
function __construct() {
parent::__construct();
$this->load->library('google');
}
public function index() {
echo $this->google->getLibraryVersion();
}
}
但是当我尝试这个谷歌客户端库时,会显示下面给出的这个错误。 Google Client.php 在此行显示第一个错误
/** @var array $scopes */
// Scopes requested by the client
protected $requestedScopes = [];
【问题讨论】:
-
我没有更改客户端库中的任何内容。如果我按照您的建议使用简单数组,那么它会在这些行上显示错误。 $this->config = Collection::fromConfig( $config, [ 'application_name' => '',
-
你的php版本是多少?
-
我认为是 5.3.13
标签: php codeigniter youtube-api google-client youtube-data-api