我需要从我的 php 网站分享一个页面到用户的 facebook 墙。如果用户未登录 facebook,我的网站使用重定向到 facebook 登录页面
$user = $facebook->getUser();
if($user) {
$result = $facebook->api(
'/me/feed/',
'POST',
array('access_token' => $this->access_token, 'link'=>'google.com', 'message' => 'Test link')
);
$this->Session->setFlash('Your link has been succesfully posted on your wall');
$this->redirect($this->referer());
}else {
$login_url_params = array(
'req_perms' => 'publish_stream',
'redirect_uri' => 'localhost/pictrail' //thts the same path I gave to my facebook app
);
$login_url = $facebook->getLoginUrl($login_url_params);
header("Location: {$login_url}");
exit();
}
因此,当用户未登录 facebook 时,它会重定向到 facebook 以供用户登录,然后无论我输入的网址如何,它都会重定向到 localhost/pictrail。我想将其重定向为 localhost/pictrail/images/param ...我该如何实现呢?我尝试了“localhost/pictrail/images/99”,但没有成功。用户登录 facebook 后一切正常。