2011-06-12 103 views
0

我想传递两个参数到$params基于函数getLoginUrl,顺便说一句我使用PHP SDK 3.0.1。扩展的权限等在facebook上的应用程序

这是我写的:

$loginUrl = $facebook->getLoginUrl(array(
              'req_perms' => 'publish_stream', 
              'next' => 'my next url', 
              )); 

不幸的是,它不工作?我敢肯定,原因是sdk的版本..登录工作正常,但没有扩展权限&下一个网址。任何帮助?谢谢。

+0

您需要更详细地告诉我们发生了什么事情,何时发生以及您正在尝试做什么。 – rzetterberg 2011-06-12 23:16:47

+0

我只想让用户连接到我的网站。当用户点击“通过Facebook登录”它确实工作,但扩展权限不会出现。 (只是'访问我的基本信息') – Luis 2011-06-12 23:21:47

+0

我解决了这个问题。'req_perms'被称为'scope','next'现在被称为'redirect_uri'。 – Luis 2011-06-12 23:51:11

回答

1

当您在评论中回答自己的问题时,我会延长答案。在21 May中,Facebook宣布升级PHP-SDK,这是一次重大升级,会破坏你的代码!

因此,检查SDK工作方式的最佳方法是访问所提供的example页面。现在你如果这都没有提供太多的信息,所以你应该寻找在base_facebook.php确实你会发现(线449):

/** 
* Get a Login URL for use with redirects. By default, full page redirect is 
* assumed. If you are using the generated URL with a window.open() call in 
* JavaScript, you can pass in display=popup as part of the $params. 
* 
* The parameters: 
* - redirect_uri: the url to go to after a successful login 
* - scope: comma separated list of requested extended perms 
* 
* @param array $params Provide custom parameters 
* @return string The URL for the login flow 
*/ 

现在最有趣的部分是getLogoutUrl()方法,因为它仍然是使用next参数!