[英]How to check if user is authenticated by cookie session on Laravel?
Well, at the moment I have 2 sites. 好吧,目前我有2个网站。
The two sites are in the same domain, so we can share cookies. 这两个站点位于同一个域中,因此我们可以共享cookie。 But I need a simple way to check if the cookie session is really authenticated on the laravel site.
但是我需要一种简单的方法来检查cookie会话是否真的在laravel站点上进行了身份验证。
My idea is expose a method over the laravel site to call it from the other php project, something like this: 我的想法是在laravel站点上公开一个方法来从其他php项目中调用它,如下所示:
public function checkUser($cookie)
{
return Auth::check($cookie);
}
There is a simple method like Auth::check($cookie) ? 有一个简单的方法,如Auth :: check($ cookie)? or what I need to accomplish this?
或者我需要做什么?
Thanks! 谢谢!
Auth::user()
将返回登录用户或FALSE
。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.