php-wechat-sdk/src/Wechat/Work/Miniprogram.php
2019-01-29 16:00:05 +08:00

18 lines
456 B
PHP

<?php
namespace Wechat\Work;
class Miniprogram extends Base
{
protected $app = 'miniprogram';
public function code2Session($type = 'authorization_code')
{
$url = "https://qyapi.weixin.qq.com/cgi-bin/miniprogram/jscode2session?js_code=$code&grant_type=$type");
$request = $this->client->transformForJsonRequest($url);
$resp = $this->client->send($request);
return json_decode($resp->getBody(), true);
}
}