Загрузка клиентской библиотеки google api в кодеритер

сначала я скопировал папку Google в application / third_party в рамках codeigniter.

затем 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(); } } 

а затем я создал контроллер с именем 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(); } } 

Но я получаю следующую ошибку …

 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 

что я делаю неправильно?

Я предполагаю, что у вас есть application/third_party каталоге application/third_party и остальной источник в application/third_party/Google .

в application/libraries/google.php удалите эту строку.

 set_include_path(APPPATH . 'third_party/' . PATH_SEPARATOR . get_include_path()); 

теперь код google.php будет

 <?php if (!defined('BASEPATH')) exit('No direct script access allowed'); require_once APPPATH . 'third_party/Google/Client.php'; class Google extends Google_Client { function __construct($params = array()) { parent::__construct(); } } 

Это избавится от этой ошибки.

Попробуйте таким образом загрузить ваши библиотеки: include_once APPPATH . "libraries/third_party/Google/Client.php"; include_once APPPATH . "libraries/third_party/Google/Client.php";