laravel - Is it possible to get session ID from cookie?
问题描述
I am learning Laravel from few days and am little confused about how the authentication works in Laravel. Where the sessions are stored?
解决方案
Getting the Session ID from a cookie?
I wasn't completely sure about what you meant by getting it from a cookie but you could try the code below.
Imports
use Illuminate\Support\Facades\Crypt;
Code
Crypt::decrypt(
\Request::cookie(
config('session.cookie')
)
)
Getting the Session ID
I have not been able to test this but I believe it should work, the 'session()' is a global variable so there's no need for any imports.
Code
$id = session('id');
Hope this answered your question, good luck!
推荐阅读
- python - Tensorflow 权重在训练前后不会改变
- html - CSS 截断带有 flex-direction 列的 flexbox 父级中的文本
- shell - 文本处理 - 将下一行附加到上一行,直到行以“^”结尾
- node.js - 在 Linux 中从节点应用程序创建单个 exe 文件
- c# - Xamarin Forms 3.6 App 在 iOS 设备上恢复时崩溃
- apache-spark - 如何在 Kubernetes 外部公开 StatefulSet cassandra 集群的无头服务
- ruby-on-rails - 在 Rails 5.2 中,使用 Carrierwave gem 当磁盘上不再存在文件时如何使用默认 gem?
- oracle - 使用 OOS_UTIL_WEB 下载已压缩的文件
- webpack - 当 nativescript 应用程序与 webpack 捆绑时出现 Javascript 堆错误
- python - 在循环中的单独行上打印值时,如何避免在最后一次迭代后打印换行符?