[英]Facebook graph api redirects to redirect_url/index.php in codeigniter
我想在代碼點火器中使用fb graph api。 該文件是:
$app_id = 'xxxx';
$app_secret = 'xxxx';
$redirect_url='http://onlineislamicquiz.net/facebook';
//3.Initialize application, create helper object and get fb sess
FacebookSession::setDefaultApplication($app_id,$app_secret);
$session="";
$helper = new FacebookRedirectLoginHelper($redirect_url);
try
{
$session = $helper->getSessionFromRedirect();
}
catch(FacebookRequestException $ex)
{
echo "Facebook returns error";
}
catch(\Exception $ex)
{
echo "There are some issues in your app";
}
// Setting facebook token to check whether user has logged in or not
if ( isset($_SESSION['fb_token']))
{
$session = new FacebookSession($_SESSION['fb_token']);
echo "Session exists already";
}
// The Url for logging out
if (!$session)
{
//store the session in a token
//else echo login
echo '<a href='.$helper->getLoginUrl(array('email')).'>';
?>
<button class="btn btn-primary">Sign up with : <i class="fa fa-facebook-square fa-2x"></i></button>
<?php
echo '</a>';
}
在以下位置有一個控制器:
處理后端。
我想重定向到:
但是,它將我重定向到:
找不到。 htaccess是:
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L]
<Files "index.php">
AcceptPathInfo On
</Files>
.htaccess似乎有問題。 請幫我解決這個問題。
試試看RewriteEngine開
RewriteBase /
RewriteCond %{REQUEST_URI} ^system.*
RewriteCond $1 !^(index\.php|images|js|uploads|css|robots\.txt)
RewriteRule ^(.*)$ /index.php/$1 [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L]
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.