Steps:
1. Open WeChat, log in to your account, and click "WeChat Official Account Settings".
2. Click "Function Settings", and then click "Settings".
3. Set the JS interface security domain name. Click OK after setting.
4. get AppID and AppSecret in the developer center.
5. Get the token. Completed on the server side, the code is as follows:
Function wx_get_token() {
$ token = S(' access _ token ');
If (! $token) {
$ RES = file _ get _ contents('/CGI-bin/token? Authorization type = customer certificate. appid= '? ? . Your appid. '&; secret= '? ? . Your appsecret');
$res = json_decode($res,true);
$ token = $ RES[' access _ token '];
6. get tickets for jsapi. Jsapi_ticket is valid for 7200 seconds and is obtained through access_token.
7.Signature: connect jsapi_ticket, noncestr, timestamp and shared url in alphabetical order for sha 1 signature.
8. After generating the signature, you can use the js code. In html, you can set the.