yagneshprajapati / url-history-tracker
一个用于跟踪和管理URL历史的包
v1.0.5
2024-08-09 12:53 UTC
Requires
- php: ^7.3|^8.0
README
url-history-tracker 是一个Laravel包,用于跟踪用户在会话期间访问的最后几个URL。它允许您轻松访问这些URL,并提供一种方便的方式将用户重定向回之前的页面或根据他们的导航历史执行其他操作。
功能
- 跟踪用户访问的最后N个URL(可配置)。
- 提供简单的API来访问第N个最后访问的URL。
- 可以通过历史位置检索URL(例如,倒数第二个,倒数第三个)。
安装
您可以通过Composer安装此包
composer require yagneshprajapati/url-history-tracker # Publish php artisan vendor:publish --tag=config --provider="YagneshPrajapati\UrlHistoryTracker\UrlHistoryTrackerServiceProvider" # Example: use Illuminate\Support\Facades\Redirect; // Get the 2nd last URL (default behavior) $secondLastUrl = Redirect::getLastUrl(); // Get the 3rd last URL $thirdLastUrl = Redirect::getLastUrl(3); // Get the most recent URL (after the first one was popped) $lastUrl = Redirect::getLastUrl(1);