Facebook graph api重定向到codeigniter中的重定向_url/index.php
我想在CodeIgniter中使用FBGraphAPI。该文件是:Facebook graph api重定向到codeigniter中的重定向_url/index.php,php,.htaccess,codeigniter,facebook-graph-api,Php,.htaccess,Codeigniter,Facebook Graph Api,我想在CodeIgniter中使用FBGraphAPI。该文件是: $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_sec
$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>';
}
$app_id='xxxx';
$app_secret='xxxx';
$redirect\u url='1http://onlineislamicquiz.net/facebook';
//3.初始化应用程序,创建帮助对象并获取fb sess
FacebookSession::setDefaultApplication($app\u id,$app\u secret);
$session=“”;
$helper=newfacebookRedirectLoginHelper($redirect\uURL);
尝试
{
$session=$helper->getSessionFromRedirect();
}
捕获(FacebookRequestException$ex)
{
echo“Facebook返回错误”;
}
捕获(\Exception$ex)
{
echo“您的应用程序中存在一些问题”;
}
//设置facebook令牌以检查用户是否已登录
如果(isset($\ U会话['fb\ U令牌]))
{
$session=newfacebooksession($_session['fb_token']);
echo“会话已存在”;
}
//用于注销的Url
如果(!$session)
{
//将会话存储在令牌中
//else-echo登录
回声'
它处理后端
我想重定向到:
但是,它让我转向:
这是找不到的。
访问权限为:
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L]
<Files "index.php">
AcceptPathInfo On
</Files>
重新编写引擎打开
重写cond%{REQUEST_FILENAME}!-f
重写cond%{REQUEST_FILENAME}!-d
重写规则^(.*)$index.php/$1[L]
上的AcceptPathInfo
.htaccess似乎有问题。请帮助我解决此问题。试试看
重新启动发动机
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]