在 Laravel 中获取在线用户
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/38811097/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Get online users in laravel
提问by paranoid
I have one user for login to demo of my script.
I want get how many people online now.
I use laravel 5.2
What am I do?
我有一个用户可以登录我的脚本演示。
我想知道现在有多少人在线。
我用laravel 5.2
我在做什么?
采纳答案by Alexey Mezenin
You could keep sessions in a DB and use last_activity
column to determine how many users are currently online.
您可以将会话保存在数据库中并使用last_activity
列来确定当前在线的用户数量。
回答by jaysingkar
There is a laravel plugin to achieve this. here's the link :https://github.com/thomastkim/laravel-online-users
有一个 Laravel 插件可以实现这一点。这是链接:https: //github.com/thomastkim/laravel-online-users
回答by Mahdi
you can use the below package in order to get online users or determine if a user is online or not.
您可以使用以下包来获取在线用户或确定用户是否在线。