public function get_url(){
$https=Request::domain();
$REQUEST_URI = $_SERVER['REQUEST_URI'];
$redirect_uri = urlencode($https . $REQUEST_URI);
$code =input('param.code',false);
$appid=$this->appid;
$appsecret=$this->secret;
if (! $code) {
$autourl = "https://open.weixin.qq.com/connect/oauth2/authorize?appid=$appid&redirect_uri=$redirect_uri&response_type=code&scope=snsapi_base&state=123#wechat_redirect";
$this->redirect($autourl);
} else {
$url = "https://api.weixin.qq.com/sns/oauth2/access_token?appid=$appid&secret=$appsecret&code=$code&grant_type=authorization_code";
return panApi($url,[],'post');
}
}
|