You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

32 lines
747 B
PHTML

3 years ago
<?php
namespace Admin\Controller;
use User\Api\UserApi;
use Com\Wechat;
use Com\WechatAuth;
use Base\Tool\TaskClient;
/**
* 小程序
*/
class MiniProgramController extends \Think\Controller
{
private $secert = 'fcd494b677bf0c9819e137538be93f10';
private $appId = 'wxb7264c023beac13c';
public function getOpenId() {
$code = I('code', '061SLWZv3QfSQW2M9A3w3MTOZj4SLWZ5');
if (!$code) {
return $this->ajaxReturn([
'status' => 0,
'msg' => 'code不能为空',
]);
}
$url = "https://api.weixin.qq.com/sns/jscode2session?appid={$this->appId}&secret={$this->secert}&js_code={$code}";
$r = file_get_contents($url);
echo $r;
}
}