TaoLer/app/middleware/Browse.php
2024-04-14 12:03:38 +08:00

21 lines
401 B
PHP

<?php
namespace app\middleware;
use think\facade\Log;
/**
* 浏览记录日志中间件
*/
class Browse
{
public function handle($request, \Closure $next)
{
$agent = $request->header('user-agent');
$ip = $request->ip();
$url = $request->url(true);
Log::channel('browse')->info('browse:{agent} {ip} {url}',['agent'=>$agent,'url'=>$url,'ip'=>$ip]);
return $next($request);
}
}