PHP code example of qingbing / yii2-access-log

1. Go to this page and download the library: Download qingbing/yii2-access-log 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-access-log example snippets


'controllerMap' => [
    // 请求访问日志
    'access-log'      => \YiiAccessLog\controllers\AccessLogController::class,
]

'bootstrap'     => [
    'bootAccessLog',
],
'components' => [
    'bootAccessLog'  => [
        'class'          => \YiiAccessLog\boots\AccessLogBootstrap::class,
        'accessLogModel' => \YiiAccessLog\models\AccessLogs::class, // 日志模型类
        'open'           => define_var('COM_BOOT_ACCESS_LOG_OPEN', true), // 开启访问日志
        'ignorePaths'    => [
            '*/list', // 列表的日志不记录,太大
        ],
    ],
],

// bootAccessLog 组件配置
defined('COM_BOOT_ACCESS_LOG_OPEN') or define('COM_BOOT_ACCESS_LOG_OPEN', true); // 开启访问日志