本文整理汇总了PHP中Facebook::redirect方法的典型用法代码示例。如果您正苦于以下问题:PHP Facebook::redirect方法的具体用法?PHP Facebook::redirect怎么用?PHP Facebook::redirect使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Facebook
的用法示例。
在下文中一共展示了Facebook::redirect方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __construct
public function __construct()
{
$facebook = new Facebook(OpfApplicationConfig::SITE_API_KEY, OpfApplicationConfig::SITE_API_SECRET);
$this->facebook = $facebook;
$facebook->require_frame();
$this->userId = $facebook->require_login();
try {
$this->addUrl = $facebook->get_add_url();
$this->isAppAdded = $facebook->api_client->users_isAppAdded();
} catch (Exception $e) {
$facebook->set_user(null, null);
$facebook->redirect(OpfApplicationConfig::APP_CALLBACK_URL);
}
}
示例2: Facebook
$facebook = new Facebook($appapikey, $appsecret);
//$profileId = $facebook->get_loggedin_user(); // If the user is logged in and looks at their own wordans app this is the way to get their profile id
$linkFromFBBanner = $_GET['linkFromFBBanner'];
//If the facebook user hasn't installed the wordans app we still want them to see it in a public canvas page
if ($linkFromFBBanner == 'true') {
//public canvas page
$user = $facebook->get_loggedin_user();
} else {
//do a login and configuration or show them the app if they have already installed it
$user = $facebook->require_login();
$appcallbackurl = 'http://www.wordans.com/wordans_flash/facebook_callback';
// catch the exception that gets thrown if the cookie has
// an invalid session_key in it
try {
if (!$facebook->api_client->users_isAppAdded()) {
$facebook->redirect($facebook->get_add_url());
}
} catch (Exception $ex) {
// this will clear cookies for your application and
// redirect them to a login prompt
$facebook->set_user(null, null);
$facebook->redirect($appcallbackurl);
}
}
?>
<!--<fb:swf swfsrc='http://www.wordans.com.com/flash/facebook/loader.swf?version="1" ' imgsrc='http://www.skeeker.com/sites/facebook/wordans/clickhere.jpg' width='185' height='280' flashvars='asset_path=http://www.skeeker.com/sites/facebook/wordans/' />-->
<script type="text/javascript" src="swfobject.js"></script>
<style type="text/css">
示例3: array
<title>FriendExport</title>
<link rel="stylesheet" type="text/css" href="assets/css/fb.css">
</head>
<body>
<?php
require_once '.' . DIRECTORY_SEPARATOR . 'global.php';
require_once INCLUDE_DIR . 'facebook.php';
// Workarounds for new fb rules re. iframe apps
$_COOKIE = array();
$secret = FB_API_SECRET;
$facebook = new Facebook(FB_API_KEY, FB_API_SECRET);
$user = $facebook->get_loggedin_user();
if (!$user) {
$user = $_REQUEST['uid'];
if (!$user) {
$facebook->redirect($facebook->get_login_url(FB_APP_URL, 1));
}
$key = $_REQUEST['key'];
$token = $_REQUEST['token'];
$check = md5($user . $secret);
if ($check != $token) {
die("Invalid Signature");
}
$facebook->set_user($user, $key);
}
$key = $facebook->api_client->session_key;
$token = md5($user . $secret);
// This is used to append to internal links
$params = "uid={$user}&key={$key}&token={$token}";
?>
<div class="fbgreybox" style="width: 500px;">Welcome to FriendExport.</div>