• <legend id='Wxxjy'><style id='Wxxjy'><dir id='Wxxjy'><q id='Wxxjy'></q></dir></style></legend>
  • <small id='Wxxjy'></small><noframes id='Wxxjy'>

    <i id='Wxxjy'><tr id='Wxxjy'><dt id='Wxxjy'><q id='Wxxjy'><span id='Wxxjy'><b id='Wxxjy'><form id='Wxxjy'><ins id='Wxxjy'></ins><ul id='Wxxjy'></ul><sub id='Wxxjy'></sub></form><legend id='Wxxjy'></legend><bdo id='Wxxjy'><pre id='Wxxjy'><center id='Wxxjy'></center></pre></bdo></b><th id='Wxxjy'></th></span></q></dt></tr></i><div id='Wxxjy'><tfoot id='Wxxjy'></tfoot><dl id='Wxxjy'><fieldset id='Wxxjy'></fieldset></dl></div>

    1. <tfoot id='Wxxjy'></tfoot>

        <bdo id='Wxxjy'></bdo><ul id='Wxxjy'></ul>

        Laravel 会话数据不会跨页面加载

        Laravel session data not sticking across page loads(Laravel 会话数据不会跨页面加载)
      1. <tfoot id='uAAj3'></tfoot>

            <tbody id='uAAj3'></tbody>

          • <legend id='uAAj3'><style id='uAAj3'><dir id='uAAj3'><q id='uAAj3'></q></dir></style></legend>

                <bdo id='uAAj3'></bdo><ul id='uAAj3'></ul>

                <small id='uAAj3'></small><noframes id='uAAj3'>

                  <i id='uAAj3'><tr id='uAAj3'><dt id='uAAj3'><q id='uAAj3'><span id='uAAj3'><b id='uAAj3'><form id='uAAj3'><ins id='uAAj3'></ins><ul id='uAAj3'></ul><sub id='uAAj3'></sub></form><legend id='uAAj3'></legend><bdo id='uAAj3'><pre id='uAAj3'><center id='uAAj3'></center></pre></bdo></b><th id='uAAj3'></th></span></q></dt></tr></i><div id='uAAj3'><tfoot id='uAAj3'></tfoot><dl id='uAAj3'><fieldset id='uAAj3'></fieldset></dl></div>
                • 本文介绍了Laravel 会话数据不会跨页面加载的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我尝试运行以下代码:

                  Session::put('progress', '5%');
                  
                  dd(Session::get('progress'));
                  

                  这将在转储中显示5%".

                  This will show '5%' in the dump.

                  如果我重新运行同一页面但注释掉 Session::put('progress', '5%'); 以便只有 dd() 行调用时,我得到一个空值,而不是上一页加载中存储的 5% 值.

                  If I rerun the same page but comment out Session::put('progress', '5%'); so that only the dd() line is called, I get a null value instead of the 5% values stored in the previous page load.

                  这是我的会话配置,所以我知道它应该存储数据:

                  Here is my sessions config, so I know it should be storing the data:

                  'driver' => 'native',
                  'lifetime' => 120,
                  'expire_on_close' => false,
                  

                  为什么 Laravel 不跨页面加载存储会话数据?

                  Why is Laravel not storing the session data across page loads?

                  推荐答案

                  问题是因为你在 Laravel 完成其应用程序生命周期之前杀死了脚本,所以放入会话中的值(但尚未存储)也被杀死了.

                  The problem is because you are killing the script before Laravel finishes its application lifecycle, so the values put in session (but not yet stored) got killed too.

                  当 Laravel 应用程序生命周期开始时,Session 中的任何值 put 都尚未存储,直到应用程序生命周期结束.这就是 Session 中的任何值 put 最终/真正 stored.

                  When a Laravel application lifecycle starts, any value put in Session are not yet stored until the application lifecycle ends. That is when any value put in Session will be finally/really stored.

                  如果您查看来源,您会发现相同的上述行为:

                  If you check the source you will find the same aforementioned behavior:

                   public function put($key, $value)
                   {
                       $all = $this->all();
                  
                       array_set($all, $key, $value);
                  
                       $this->replace($all);
                   }
                  

                  <小时>

                  如果要测试它,请执行以下操作:


                  If you want to test it, do the following:

                  1. 在会话中存储一个值而不杀死脚本.

                  1. Store a value in session without killing the script.

                  Route::get('test', function() {
                      Session::put('progress', '5%');
                      // dd(Session::get('progress'));
                  });
                  

                • 检索已经存储的值:

                  Route::get('test', function() {
                      // Session::put('progress', '5%');
                      dd(Session::get('progress'));
                  });
                  

                • 这篇关于Laravel 会话数据不会跨页面加载的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

                  相关文档推荐

                  DeepL的翻译效果还是很强大的,如果我们要用php实现DeepL翻译调用,该怎么办呢?以下是代码示例,希望能够帮到需要的朋友。 在这里需要注意,这个DeepL的账户和api申请比较难,不支持中国大陆申请,需要拥有香港或者海外信用卡才行,没账号的话,目前某宝可以
                  PHP通过phpspreadsheet导入Excel日期,导入系统后,全部变为了4开头的几位数字,这是为什么呢?原因很简单,将Excel的时间设置问文本,我们就能看到该日期本来的数值,上图对应的数值为: 要怎么解决呢?进行数据转换就行,这里可以封装方法,或者用第三方的
                  mediatemple - can#39;t send email using codeigniter(mediatemple - 无法使用 codeigniter 发送电子邮件)
                  Laravel Gmail Configuration Error(Laravel Gmail 配置错误)
                  Problem with using PHPMailer for SMTP(将 PHPMailer 用于 SMTP 的问题)
                  Issue on how to setup SMTP using PHPMailer in GoDaddy server(关于如何在 GoDaddy 服务器中使用 PHPMailer 设置 SMTP 的问题)
                  <i id='UxVPO'><tr id='UxVPO'><dt id='UxVPO'><q id='UxVPO'><span id='UxVPO'><b id='UxVPO'><form id='UxVPO'><ins id='UxVPO'></ins><ul id='UxVPO'></ul><sub id='UxVPO'></sub></form><legend id='UxVPO'></legend><bdo id='UxVPO'><pre id='UxVPO'><center id='UxVPO'></center></pre></bdo></b><th id='UxVPO'></th></span></q></dt></tr></i><div id='UxVPO'><tfoot id='UxVPO'></tfoot><dl id='UxVPO'><fieldset id='UxVPO'></fieldset></dl></div>
                  <tfoot id='UxVPO'></tfoot>

                    <small id='UxVPO'></small><noframes id='UxVPO'>

                        <bdo id='UxVPO'></bdo><ul id='UxVPO'></ul>

                        <legend id='UxVPO'><style id='UxVPO'><dir id='UxVPO'><q id='UxVPO'></q></dir></style></legend>
                            <tbody id='UxVPO'></tbody>