1. <small id='hGSjP'></small><noframes id='hGSjP'>

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

    <tfoot id='hGSjP'></tfoot>

      <legend id='hGSjP'><style id='hGSjP'><dir id='hGSjP'><q id='hGSjP'></q></dir></style></legend>
        <bdo id='hGSjP'></bdo><ul id='hGSjP'></ul>
    1. PHP:在标头重定向之前会话未保存

      PHP: session isn#39;t saving before header redirect(PHP:在标头重定向之前会话未保存)

    2. <i id='EzMBw'><tr id='EzMBw'><dt id='EzMBw'><q id='EzMBw'><span id='EzMBw'><b id='EzMBw'><form id='EzMBw'><ins id='EzMBw'></ins><ul id='EzMBw'></ul><sub id='EzMBw'></sub></form><legend id='EzMBw'></legend><bdo id='EzMBw'><pre id='EzMBw'><center id='EzMBw'></center></pre></bdo></b><th id='EzMBw'></th></span></q></dt></tr></i><div id='EzMBw'><tfoot id='EzMBw'></tfoot><dl id='EzMBw'><fieldset id='EzMBw'></fieldset></dl></div>
            <tbody id='EzMBw'></tbody>
          <legend id='EzMBw'><style id='EzMBw'><dir id='EzMBw'><q id='EzMBw'></q></dir></style></legend>
        1. <tfoot id='EzMBw'></tfoot>
            • <bdo id='EzMBw'></bdo><ul id='EzMBw'></ul>

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

                本文介绍了PHP:在标头重定向之前会话未保存的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                问题描述

                我已经阅读了这个问题的 php 手册,这似乎是一个很常见的问题,但我还没有找到解决方案.我将会话保存在数据库中.我的代码如下:

                I have read through the php manual for this problem and it seems quite a common issue but i have yet to find a solution. I am saving sessions in a database. My code is as follows:

                // session
                $_SESSION['userID'] = $user->id;        
                header('Location: /subdirectory/index.php');
                

                然后在 session_start() 之后的 index.php 顶部,我已经 var_dumped 全局 $_SESSION 并且用户 ID 不在其中.正如我所说,我浏览了 PHP 手册 (http://php.net/manual/en/function.session-write-close.php) 并且没有 session_write_closesession_regenerate_id(true) 为我工作.有人知道解决方案吗?

                Then at the top of index.php after the session_start(), i have var_dumped the $_SESSION global and the userID is not in there. As i said ive looked through the PHP manual (http://php.net/manual/en/function.session-write-close.php) and neither session_write_close or session_regenerate_id(true) worked for me. Does anybody know a solution?

                我的文件顶部有 session_start().当我在标头重定向之前对会话全局进行 var_dump 时,我在其中看到了用户 ID,但在位于该脚本的子目录中的另一个文件中没有看到

                I have session_start() at the top of my file. When i var_dump the session global before the header redirect, i see the userID in there, but not in the other file, which is in a subdirectory of this script

                推荐答案

                我知道这是一个老话题,但我找到了解决方案(对我来说).我在标题后面放了一个出口.

                I know this is an old toppic but I found the solution (for me). I've put a exit after the header.

                $_SESSION['session'] = 'this is a session';
                header('location: apage.php');
                exit;
                

                这对我有用

                这篇关于PHP:在标头重定向之前会话未保存的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

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

                相关文档推荐

                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 的问题)

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

                    • <bdo id='hymEo'></bdo><ul id='hymEo'></ul>
                        <tfoot id='hymEo'></tfoot>

                          <tbody id='hymEo'></tbody>

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