12345678910111213141516 |
- <?php
- /**
- * Created by PhpStorm.
- * User: james
- * Date: 2017/4/25
- * Time: 下午3:43
- */
- include 'config.php';
- //设置state 一个随机码并使用session记录
- $_SESSION['state'] = md5(rand(111111, 99999999));
- $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';
- //跳转即可
- Log::record("url={$url}",Log::DEBUG);
- header('location:'.$url);
|