[英]count visitor of pages in laravel
我如何計算 Laravel 中頁面的訪問者,更喜歡使用緩存
public function IndexShow(){
Cache::put('home',0);
$counter = Cache::increment('home',1);
}
如果谷歌分析不適合您,請查看此軟件包。 - https://github.com/antonioribeiro/tracker
他們已經考慮好了你會尋求做的一些事情。 你最終會得到類似下面的結果。
//in your controller
$weeklyUsers = Tracker::users(60 * 24 * 7);
//in your blade
<div>
<span class="h4 d-block font-weight-normal mb-2">{{ $weeklyUsers }}</span>
<span class="font-weight-light"><strong>TOTAL VISITOR</strong></span>
</div>
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.