如何在Zend Framework 2中使用Facebook PHP SDK [英] How to use Facebook PHP SDK with Zend Framework 2

查看:73
本文介绍了如何在Zend Framework 2中使用Facebook PHP SDK的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我希望能够将Facebook PHP SDK与新的ZEND Framework 2平台一起使用.怎么做?

I want to be able to use the Facebook PHP SDK with the new ZEND Framework 2 platform. How to do it?

Zend Framework 2与以前的版本ZF1完全不同.

Zend Framework 2 is quite different as previous version ZF1.

当我在主应用程序控制器IndexController中尝试标准PHP时:

When I try the standard PHP in the main application controller IndexController':

require_once("facebook.php");

class IndexController extends AbstractActionController
{

    public $facebook;

    public function  __construct() {

        $this->facebook = new Facebook(array(
                'appId'  => 'appId',
                'secret' => 'secret_key'
        ));

    }

    /*
    ...
    */

}

我收到以下错误:致命错误:无法在第160行的/../module/Application/src/Application/Controller/Facebook.php中重新声明类Facebook

I get following error: Fatal error: Cannot redeclare class Facebook in /../module/Application/src/Application/Controller/Facebook.php on line 160

推荐答案

我无法具体帮助您解决ZF1和ZF2,但在Google中进行的简单搜索为我提供了此结果,我认为是因为ZF自动加载了类并您试图再次要求它们有冲突.

I can't help you specifically on the difference between ZF1 & ZF2 but a simple search in google gave me this result, I think because ZF autoloads classes and you tried to require it again they are in conflict.

这篇关于如何在Zend Framework 2中使用Facebook PHP SDK的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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