首先我将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
我做错了什么?
答案 0 :(得分:0)
我假设您在autoload.php
目录中有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();
}
}
这将消除该错误。
答案 1 :(得分:0)
请尝试以这种方式加载您的库:var str = `\n\tvar whatTheHell = 1234;\n
\t\tvar ojb = {
\t\tfoo : \"bar\",
...
}`
console.log(decodeURIComponent(str))