123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657 |
- <?php
- /**
- * Created by PhpStorm.
- * User: stanley-king
- * Date: 2017/4/26
- * Time: 下午2:46
- */
- require_once (BASE_ROOT_PATH . '/helper/third_author/wxauthor.php');
- require_once (BASE_ROOT_PATH . '/helper/session.php');
- ini_set('date.timezone','Asia/Shanghai');
- error_reporting(E_ERROR);
- $code = $_GET['code'];
- if(empty($code)) {
- Log::record("没有同意授权");
- }
- else
- {
- $author = new \thrid_author\wxauthor();
- $user_info = $author->callback($code);
- if($user_info == false)
- {
- Log::record("微信取到的信息为空",Log::DEBUG);
- }
- else
- {
- $_SESSION['wx_author']['user_info'] = $user_info;
- $_SESSION['wx_author']['handled'] = false;
- if(array_key_exists('author_orgin_url',$_SESSION))
- {
- $origin_url = $_SESSION['author_orgin_url'];
- unset($_SESSION['author_orgin_url']);
- Log::record("origin_url={$origin_url}",Log::DEBUG);
- if(!empty($origin_url))
- {
- $html = "<!DOCTYPE html>
- <html lang=\"en\">
- <head>
- <meta charset=\"UTF-8\">
- <title>跳转中</title>
- </head>
- <body>
- <script>
- window.location.href =\"{$origin_url}\";
- </script>
- </body>
- </html>";
- echo $html;
- }
- }
- }
- }
|