工具

提供微信网页开发 JS-SDK 相关方法

配置

<?php
use EasyWeChat\OfficialAccount\Application;

$config = [...];

$app = new Application($config);

$utils = $app->getUtils();
1
2
3
4
5
6
7
8

生成 JS-SDK 签名

📖 官方文档 - JS-SDK说明文档open in new window

$config = $utils->buildJsSdkConfig(
    url: $url, 
    jsApiList: [],
    openTagList: [], 
    debug: false, 
);

// print
[
    "appId" => "wx...",
    "jsApiList" => [],
    "nonceStr" => "string",
    "openTagList" => [],
    "signature" =>  "sign",
    "timestamp" =>  "timestamp"
];

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17