PHP code example of wss0823 / module-log-middleware

1. Go to this page and download the library: Download wss0823/module-log-middleware 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/ */

    

wss0823 / module-log-middleware example snippets


return [
    'default' => [
        ......
        'providers'           => [
            ......
             \Uniondrug\Middleware\MiddlewareServiceProvider::class,
            \Uniondrug\ModuleLogMiddleware\LogMiddleware::class,
        ],
    ],
];

return [
    'default' => [
        // 应用定义的中间件
        'middlewares' => [
            // 注册名为token的中间件
            'addLog' => \Uniondrug\ModuleLogMiddleware\LogMiddleware::class,
        ],
        // 将token中间件放在全局中间列表中
        'global' => [
            'addLog'
        ],
        'addLog' => [
            'whitelist' => [
                //请求controllers 路由名称
                'amap' => [
                    //请求function 路由名称 & 路由备注
                    'search' => '地图查询',
                ],
            ]
        ]
    ]
];