PHP code example of haaid / ucenter

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

    

haaid / ucenter example snippets


UCenter::routes();

use UCenter;

$result = UCenter::uc_get_user('admin');
var_dump($result);

return [
    'service' => env('UC_SERVICE', 'App\Services\UCenter'),
];



namespace App\Services;

class UCenter extends \Haaid\UCenter\Services\Api
{
    public function synlogin()
    {
        $uid = $this->get['uid'];
        $username = $this->get['username'];
        $password = $this->get['password'];
        $time = $this->get['time'];

        /*
         * 业务代码编写
         */

        return API_RETURN_SUCCEED;
    }
}

# 建议
UCenter::routes();
# 或者
Route::any(config('ucenter.url') . '/api/' . config('ucenter.apifilename'), '\Haaid\UCenter\Controllers\ApiController@run');
bash
php artisan vendor:publish --provider="Haaid\UCenter\UCenterServiceProvider"