简体   繁体   English

Facebook图形API重定向到Codeigniter中的redirect_url / index.php

[英]Facebook graph api redirects to redirect_url/index.php in codeigniter

I want to use fb graph api in code igniter. 我想在代码点火器中使用fb graph api。 The file is: 该文件是:

$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>';
}

There is a controller at : 在以下位置有一个控制器:

http://onlineislamicquiz.net/facebook http://onlineislamicquiz.net/facebook

which handles backend. 处理后端。

I want to redirect to the: 我想重定向到:

http://onlineislamicquiz.net/facebook http://onlineislamicquiz.net/facebook

But, it redirects me to: 但是,它将我重定向到:

http://onlineislamicquiz.net/facebook/index.php?code=AQAjmLnAEQL1yD8alM1yneGQMmWEVWNDsIF6aKra5xr7k2EQqyPkybo84-vbHRjQw1Nt2Fb3bdn4pbSN9w1WarRF7GkF3Q1nrZ--n0aHPqZ4x9p54vei7qsrHk-zidAHQAGRd8kZl-6Cs8uDpJoIEORV8bFiY8XssjeoXExAFIWh6uQAVOO4HqOqxKGPz3siGpXh_ogUScGbJCyo2IAak_gu5rGR8L9mQpsCOQZsss6RMdTIJNGYWXp7vxSYryB-Ekr4uYRhWGGC-GHfxAMD0nYHKioGqPZPt-bkgQDDSa_vBxJIgjUpgj5nnTs9X3sgohy0MdjG3sNmhbIPX9WHPPQM&state=cc43abcbabab5072447a0faa26b36d27# = http://onlineislamicquiz.net/facebook/index.php?code=AQAjmLnAEQL1yD8alM1yneGQMmWEVWNDsIF6aKra5xr7k2EQqyPkybo84-vbHRjQw1Nt2Fb3bdn4pbSN9w1WarRF7GkF3Q1nrZ--n0aHPqZ4x9p54vei7qsrHk-zidAHQAGRd8kZl-6Cs8uDpJoIEORV8bFiY8XssjeoXExAFIWh6uQAVOO4HqOqxKGPz3siGpXh_ogUScGbJCyo2IAak_gu5rGR8L9mQpsCOQZsss6RMdTIJNGYWXp7vxSYryB-Ekr4uYRhWGGC-GHfxAMD0nYHKioGqPZPt-bkgQDDSa_vBxJIgjUpgj5nnTs9X3sgohy0MdjG3sNmhbIPX9WHPPQM&state=cc43abcbabab5072447a0faa26b36d27# =

which is not found. 找不到。 The htaccess is: htaccess是:

RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L]

<Files "index.php">
AcceptPathInfo On
</Files>

Looks like there is something wrong with .htaccess. .htaccess似乎有问题。 Please help me to solve this. 请帮我解决这个问题。

try it RewriteEngine On 试试看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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM