小程序
parent
9ad1ae5e31
commit
c80609be77
@ -0,0 +1,31 @@
|
||||
<?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;
|
||||
}
|
||||
|
||||
|
||||
}
|
Loading…
Reference in New Issue