PHP code example of jackliu / openplatform
1. Go to this page and download the library: Download jackliu/openplatform library. Choose the download type require. 2. Extract the ZIP file and open the index.php. 3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
jackliu / openplatform example snippets
protected $config=[
'encodingAesKey'=>'',//设置aesKey
'client_id'=>'',//设置第三方平台secret
'redirect_uri'=>'',//设置授权后回调URI
'debug'=>true//生产模式时请设置为false,并且按照文档添加数据库
];
$app=new Application($this->config);
$app->serve();接收服务器推送时返回success,并缓存
$app->ticket();解密获取ticket
$app->tpToken();//获取第三方平台的AccessToken并缓存
$app->preAuthCode();获取预授权码
$app->jumpToAuth();//前往授权页;
$app->authCode();//获取授权码,一般在回调页调用
$app->refreshToken();//刷新授权小程序的AccessToken;
$app->mpToken();//获取授权小程序的AccessToken;存入数据库
$app->mpInfo();//获取授权小程序的信息