我想将两个参数传递给基于函数getLoginUrl
的数组$params
,顺便说一句,我使用的是php-sdk 3.0.1。
我写的是:
$loginUrl = $facebook->getLoginUrl(array(
'req_perms' => 'publish_stream',
'next' => 'my next url',
));
不幸的是,它不起作用?我很确定原因是sdk的版本。。登录运行良好,但没有扩展权限&下一个url。有什么帮助吗?非常感谢。
当您在评论中回答自己时,我将扩展答案。5月21日,Facebook宣布升级PHP-SDK,这是一次重大升级,会破坏您的代码!
因此,检查SDK新工作方式的最佳方法是访问提供的示例页面。现在,对于您的案例,这并不能提供太多信息,所以您应该查看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
参数!