PHP code example of qingbing / yii2-short-url

1. Go to this page and download the library: Download qingbing/yii2-short-url 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/ */

    

qingbing / yii2-short-url example snippets


// 客户短链系统访问时的终端地址
Yii::$app->params['baseUrlForShortUrl']

# 添加URL使用
\YiiShortUrl\logics\LogicShortUrl::getInstance()->add($params);

# 对于访问短链,提供action: \YiiShortUrl\actions\RedirectAccess

'params'     => [
    'baseUrlForShortUrl' => define_var('PARAM_BASE_URI_FOR_SHORT', 'http://www.phpcorner.net/s'),
],

// 短链系统访问baseUri
defined('PARAM_BASE_URI_FOR_SHORT') or define('PARAM_BASE_URI_FOR_SHORT', 'http://www.phpcorner.net/s');