Facebook PHP SDK& Codeigniter:无法加载配置 [英] Facebook PHP SDK & Codeigniter: Unable to load config
本文介绍了Facebook PHP SDK& Codeigniter:无法加载配置的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
my config / facebook.php
my config/facebook.php
$config['appId'] = 'XXXXX';
$config['secret'] = 'XXXX';
$config['fb_access_token'] = 'XXXXXX';
我的控制器:
$this->load->library('Facebook');
echo $this->config->item('fb_access_token');
不会为令牌输出任何内容?但我知道库正在加载,因为我可以调用getAppID确定。
Outputs nothing for the the token? yet I know the library is loading as I can call getAppID ok. It just doesn't seem to be loading this config file.
也尝试过这个控制器:
$this->config->load("facebook",TRUE);
$config = $this->config->item('facebook');
$this->load->library('facebook', $config);
推荐答案
加载库的正确方法:
$this->config->load('facebook');
$config = array(
'appId' => $this->config->item('appId'),
'secret' => $this->config->item('secret'),
);
$this->load->library('facebook', $config);
您之后才可以设置访问令牌:
You can set the access token only afterwards:
$this->facebook->setAccessToken($this->config->item('fb_access_token'));
这篇关于Facebook PHP SDK& Codeigniter:无法加载配置的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文