Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
T
tl_estate
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
hujun
tl_estate
Commits
ec644fc7
Commit
ec644fc7
authored
Nov 13, 2018
by
zhuwei
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
静默授权
parent
b0d92a8d
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
11 deletions
+15
-11
WxCallbackUntils.php
application/api/untils/WxCallbackUntils.php
+15
-11
No files found.
application/api/untils/WxCallbackUntils.php
View file @
ec644fc7
...
...
@@ -39,13 +39,6 @@ class WxCallbackUntils
header
(
"Location:"
.
$url
);
}
public
function
getWxCodesnSapiBase
(
$redirect_url
)
{
$redirect_url
=
urlencode
(
$redirect_url
);
$url
=
"https://open.weixin.qq.com/connect/oauth2/authorize?appid="
.
$this
->
appId
.
"&redirect_uri="
.
$redirect_url
.
"&response_type=code&scope=snsapi_base&state=STATE#wechat_redirect"
;
header
(
"Location:"
.
$url
);
}
/**
* 获取access_token
...
...
@@ -97,18 +90,29 @@ class WxCallbackUntils
return
$data
;
}
/**
* 获取用户信息
* 静默授权,用户无感知
* @param $redirect_url
*/
public
function
getWxCodesnSapiBase
(
$redirect_url
)
{
$redirect_url
=
urlencode
(
$redirect_url
);
$url
=
"https://open.weixin.qq.com/connect/oauth2/authorize?appid="
.
$this
->
appId
.
"&redirect_uri="
.
$redirect_url
.
"&response_type=code&scope=snsapi_base&state=STATE#wechat_redirect"
;
header
(
"Location:"
.
$url
);
}
/**
* 静默授权用
* @param $code
* @return
array
* @return
mixed
*/
public
function
getUserOpenId
(
$code
)
{
$access_token_info
=
$this
->
getAccessTokenByCode
(
$code
);
$access_token_info
=
json_decode
(
$access_token_info
);
$open_id
=
$access_token_info
->
openid
;
return
$open_id
;
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment