問題描述
我已經(jīng)在我的 facebook 應用程序注銷選項中實現(xiàn)了,但不幸的是,它在 rediredt 循環(huán)中出錯了..有誰知道 facebook sdk 是否將我重定向回原始頁面,或重定向到主頁面 whicj 設置在developer.facebook.com 管理中的應用程序設置?無論如何,有沒有可能如何在不重定向的情況下從我的應用程序注銷?例如使用 cUrl 請求到注銷 url,這可能嗎?
I've implemented in my facebook app logout option, but unfortunately, it errors on rediredt loop..Does anyone know if the facebook sdk, redirects me back to the original page, or to the main page whicj is set in the applications settings in developers.facebook.com administration?? Anyway, is there any possibility how to logout from my app without redirecting?For example with cUrl request to the logout url, is that possible?
推薦答案
您可以考慮使用 FB javascript SDK 進行注銷,然后您不需要重定向(也可以注冊 javascript 回調(diào)并使用 window.location 來做到這一點):
You could consider using the FB javascript SDK for doing the logout and then you do not need to redirect (it is also possible to register a javascript callback and use window.location to do that):
FB.logout(函數(shù)(響應){//用戶現(xiàn)在已注銷window.location = "xxxx";});
FB.logout(function(response) { // user is now logged out window.location = "xxxx"; });
如果你想使用php sdk,你可以傳入一個next"參數(shù),和你想直接訪問的頁面:$location = (string) html_entity_decode($facebook->getLogoutUrl(array('next' => 'mysite.com')));
If you want to use the php sdk, you can pass in a "next" parameter, with the page you want to direcrect to: $location = (string) html_entity_decode($facebook->getLogoutUrl(array('next' => 'mysite.com')));
這篇關于Facebook PHP SDK 注銷的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網(wǎng)!