作者 潘浩文
1 个管道 的构建 通过 耗费 1 秒

个人中心接口设计

... ... @@ -16,17 +16,10 @@ use app\portal\service\ToolsService;
class AdminPostController extends AdminBaseController
{
protected $appid;
protected $app_secret;
public function __construct()
{
$this->appid = config('app_id');
$this->app_secret = config('app_secret');
}
public function getAccessToken()
{
$url = 'https://api.weixin.qq.com/cgi-bin/token?grant_type=client_credential&appid=' . $this->appid . '&secret=' . $this->app_secret;
$url = 'https://api.weixin.qq.com/cgi-bin/token?grant_type=client_credential&appid=' . config('app_id') . '&secret=' . config('app_secret');
$html = file_get_contents($url);
$output = json_decode($html, true);
$access_token = $output['access_token'];
... ...