Skip to content

Commit

Permalink
公众号工具示例完善
Browse files Browse the repository at this point in the history
公众号JS-SDK配置示例
  • Loading branch information
pengxuxu authored Mar 14, 2024
1 parent 6554500 commit 9c18383
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions docs/src/6.x/official-account/utils.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,3 +38,29 @@ $config = $utils->buildJsSdkConfig(
];

```

## 示例
页面生成js配置(1.4和1.6版本任选一即可):
```html
<script src="https://res.wx.qq.com/open/js/jweixin-1.4.0.js" type="text/javascript" charset="utf-8"></script>
<!-- <script src="https://res.wx.qq.com/open/js/jweixin-1.6.0.js" type="text/javascript" charset="utf-8"></script> -->
<script type="text/javascript" charset="utf-8">
wx.config(<?php echo json_encode($app->getUtils()->buildJsSdkConfig('当前页面url', ['updateAppMessageShareData', 'updateTimelineShareData'], [], false)); ?>);
</script>
```
结果如下:
```html
<script src="https://res.wx.qq.com/open/js/jweixin-1.4.0.js" type="text/javascript" charset="utf-8"></script>
<script type="text/javascript" charset="utf-8">
wx.config({
"jsApiList":["updateAppMessageShareData","updateTimelineShareData"],
"openTagList":[],
"debug":false,
"url":"当前页面url",
"nonceStr":"mYEeh068LPuWp06u",
"timestamp":1710381708,
"appId":"wxcb0f*****f5f6c2",
"signature":"9147682d4f77f7f03162915446f90288cafbda93"
});
</script>
```

0 comments on commit 9c18383

Please sign in to comment.