PHP code example of soxft / openidsdk

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

    

soxft / openidsdk example snippets



    use soxft\OpenIdSdk; //使用命名空间

    $xopenid = new OpenIdSdk('appid', 'app_secret');

    $xopenid->jump('redirect_uri'); //该方法将会直接跳转至授权界面, 不用让用户点击


    use soxft\OpenIdSdk; //使用命名空间

    $xopenid = new OpenIdSdk('appid', 'app_secret');

    $res = $xopenid->getUserInfo($_GET['token'] ?? ""); // 如果token正确 该方法会返回用户信息

    print_r($res); //输出用户信息

    /** 用户登录逻辑代码 **/