Facebook PHP SDK不能作为库加载到CodeIgniter中 [英] Facebook PHP SDK not loading as a library in CodeIgniter

查看:108
本文介绍了Facebook PHP SDK不能作为库加载到CodeIgniter中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个问题,只需加载Facebook PHP SDK(v3.1.1)作为库在CodeIgniter 2.0。

I'm having a problem simply loading the Facebook PHP SDK (v3.1.1) as library in CodeIgniter 2.0.

1)我把最新的Facebook SDK文件('facebook.php','base_facebook.php'和'fb_ca_chain_bundle.crt')到我的应用程序/ libraries文件夹。

1) I've put the latest Facebook SDK files ('facebook.php', 'base_facebook.php', and 'fb_ca_chain_bundle.crt' ) into my application/libraries folder.

2)我已将facebook.php的文件名更改为Facebook.php。

2) I've changed the filename of 'facebook.php' to 'Facebook.php'.

3)在我的控制器中,我有以下代码:

3) In my controller, I have the following code:

$fb_config = array(
   'appId'  => 'XXXXXXX',          
   'secret' => 'XXXXXXX'
  );
$this->load->library('facebook', $fb_config);

$this->load->view('home_view');

但我只是得到一个错误,并且视图没有加载。

But I just get an error and the View does not get loaded.

如果我注释掉该行

  $this->load->library('facebook', $fb_config);

那么View正确加载,所以我知道问题在这里。

then the View loads correctly, so I know the problem is here.

4)如果我尝试自动加载facebook库,我得到类似的结果。

4) If I try to autoload the facebook library, I get similar results.

任何人都可以帮助?谢谢。

Can anyone help? Thanks.

推荐答案

我想出了问题。

缺少PHP cURL扩展,因此当检查是否安装了cURL时,base_facebook.php文件中的代码中止。不确定为什么我没有看到任何PHP致命错误的迹象。

I was missing the PHP cURL extension, so the code aborted in the "base_facebook.php" file when it checked if I had cURL installed. Not sure why I did not see any sign of a PHP Fatal Error.

安装此软件包后,一切正常。

After I installed this package, all is well.

这篇关于Facebook PHP SDK不能作为库加载到CodeIgniter中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆