PHP code example of minms / code2session

1. Go to this page and download the library: Download minms/code2session 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/ */

    

minms / code2session example snippets


use Minms\Code2Session\Code2Session;

$code = '';
$config = [
    'wechat' => [
        'appid' => '',
        'secret' => '',
    ],
    'toutiao' => [
        'appid' => '',
        'secret' => '',
    ]
];

$instance = Code2Session::instance($config);
$result = $instance->driver('wechat')->session($code);
var_dump($result);