Skip to content
On this page

工具6.7.1+

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

配置

php
<?php
use EasyWeChat\Work\Application;

$config = [...];

$app = new Application($config);

$utils = $app->getUtils();

生成 config 接口配置

📖 官方文档 - config 接口配置 说明文档

php
$config = $utils->buildJsSdkConfig(
    string $url,
    array $jsApiList,
    array $openTagList = [],
    bool $debug = false,
    bool $beta = true
);

// print
[
    'jsApiList' => ['api1','api2'],
    'openTagList' => ['openTag1','openTag2'],
    'debug' => false,
    'beta' => true,
    'url' => 'https://easywechat.com/',
    'nonceStr' => 'mock-nonce',
    'timestamp' => 1601234567,
    'appId' => 'mock-appid',
    'signature' => '22772d2fb393ab9f7f6a5a54168a566fbf1ab767'
];

生成 agentConfig 接口配置

📖 官方文档 - agentConfig 接口配置 说明文档

php
$config = $utils->buildJsSdkAgentConfig(
    int $agentId,
    string $url,
    array $jsApiList,
    array $openTagList = [],
    bool $debug = false
);

// print
[
    'jsApiList' => ['api1','api2'],
    'openTagList' => ['openTag1','openTag2'],
    'debug' => false,
    'url' => 'https://easywechat.com/',
    'nonceStr' => 'mock-nonce',
    'timestamp' => 1601234567,
    'corpid' => 'mock-corpid',
    'agentid' => 100001,
    'signature' => '22772d2fb393ab9f7f6a5a54168a566fbf1ab767'
];

Released under the MIT License.