首先,我将 Google 文件夹复制到 codeigniter 框架中的 application/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();
}
}
然后我创建了一个名为 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
我做错了什么?
我假设你有autoload.php
in application/third_party
目录,以及其余源代码application/third_party/Google
目录。
in the application/libraries/google.php
删除这一行。
set_include_path(APPPATH . 'third_party/' . PATH_SEPARATOR . get_include_path());
现在的代码google.php
will be
<?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();
}
}
这将消除该错误。
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)