PHP code example of yingouqlj / wechat-mini-program-lite

1. Go to this page and download the library: Download yingouqlj/wechat-mini-program-lite 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/ */

    

yingouqlj / wechat-mini-program-lite example snippets




use Yingou\MiniProgram\MiniProgram;
$config=[
    'appId' => 'appid',
    'secret' => 'secret'
    ];
$program=new MiniProgram($config);
//创建Qrcode
$program->createQrCode->create('/page?id=1',120);




class ProgramConfig extends \Yingou\MiniProgram\Config{
    public function getAccessToken()
    {
        //覆盖掉原来的方法在这里 读取token
    }
     public function setAccessToken($token, $expires = 0)
     {
          //覆盖写入 如 redis      
     }   
}

use Yingou\MiniProgram\MiniProgram;
$program=new MiniProgram(new ProgramConfig());
$program->createQrCode->create('/page?id=1',120);