只要在login上傳入 display=touch 就可以換成手機版的頁面
display=wap 也可以,以下的code專給大螢幕的手機使用,像iphone
實作範例教學:
include('inc/facebook.php');
$facebook = new Facebook(
array(
'appId' => $facebook_app_key, //appid
'secret' => $facebook_app_secret, //appsecret
'cookie' => true,
)
);
$aLoginParam = array(
'display' => 'touch' //手機模式畫面
,'req_perms' => 'user_checkins' //打卡權限
,'cancel_url' => 'http://'.$server.'/facebook/index.php'
);
if( $session = $facebook->getSession() ){
$fb_id = $facebook->getUser();
//檢查權限
try{
$perm = $facebook->api(array(
'method' => 'fql.query',
'query' => 'select user_checkins from permissions where uid='.$fb_id
));
if( $perm[0]['user_checkins'] != '1' ){ //有權限
$url = $facebook->getLoginUrl($aLoginParam);
header('Location: '.$url); exit;
}
}catch (Exception $e) { }
}else{
$url = $facebook->getLoginUrl($aLoginParam);
header('Location: '.$url); exit;
}
沒有留言:
張貼留言