Skip to content

Instantly share code, notes, and snippets.

@explon
Last active September 24, 2015 00:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save explon/f846b6e5daa352ec6ff6 to your computer and use it in GitHub Desktop.
Save explon/f846b6e5daa352ec6ff6 to your computer and use it in GitHub Desktop.
SSO 服务端例子
<?php
if ($_GET['token'])
{
// 解密认证过程省略..
// 认证成功
if ($sso_valid)
{
$output = array(
'state' => 'success'
);
// 设置 Cookie
setcookie('user_login', '......');
}
else
{
$output = array(
'state' => 'error'
);
}
echo $_GET['jsoncallback'] . '(' . json_encode($output) . ')';
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment