index.php 496 B

12345678910111213141516
  1. <?php
  2. /**
  3. * Created by PhpStorm.
  4. * User: james
  5. * Date: 2017/4/25
  6. * Time: 下午3:43
  7. */
  8. include 'config.php';
  9. //设置state 一个随机码并使用session记录
  10. $_SESSION['state'] = md5(rand(111111, 99999999));
  11. $url = 'https://open.weixin.qq.com/connect/oauth2/authorize?appid='.appID.'&redirect_uri='.urlencode(BACKURL).'&response_type=code&scope=snsapi_userinfo&state='.$_SESSION['state'].'#wechat_redirect';
  12. //跳转即可
  13. Log::record("url={$url}",Log::DEBUG);
  14. header('location:'.$url);