PHP code example of php-cas / think-cas

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

    

php-cas / think-cas example snippets


use PhpCas\Cas;
y(
    'cas_server_url' => 'https://sso.pplive.cn/cas/',
    'cas_disable_server_validation' => TRUE,
    'cas_debug' => FALSE,
    'cas_server_ca_cert' => ''
);
$cas = new Cas($config);

function login($cas) {
    $cas->force_auth();

namespace app\index\controller;
use think\oauth\driver\Sso;
class Index
{
    public function index()
    {
        $default = [
            'cas_server_url' => 'https://xxx/cas/',//sso服务器地址
            'cas_disable_server_validation' => TRUE,
            'cas_debug' => FALSE,
            'cas_server_ca_cert' => ''
        ];
        $sso=new Sso($default);
        $sso->login();     
    }