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

    1. <legend id='sbiis'><style id='sbiis'><dir id='sbiis'><q id='sbiis'></q></dir></style></legend>

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

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

        “会话已经开始……"Zend Framework 应用程序中的异常

        quot;session has already been started....quot; exception in Zend Framework application(“会话已经开始……Zend Framework 应用程序中的异常)

        <legend id='nHO5M'><style id='nHO5M'><dir id='nHO5M'><q id='nHO5M'></q></dir></style></legend>
            <tbody id='nHO5M'></tbody>
          <tfoot id='nHO5M'></tfoot>

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

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

                1. 本文介绍了“会话已经开始……"Zend Framework 应用程序中的异常的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我在尝试加载 Zend Framework 应用程序时收到此错误:

                  I get this error when trying to load a Zend Framework application:

                  致命错误:未捕获的异常带有消息的Zend_Session_Exception"'会话已经由session.auto-start 或 session_start()'在/www/htdocs/w00a1ed7/autospin/redaktion/library/Zend/Session.php:462

                  Fatal error: Uncaught exception 'Zend_Session_Exception' with message 'session has already been started by session.auto-start or session_start()' in /www/htdocs/w00a1ed7/autospin/redaktion/library/Zend/Session.php:462

                  堆栈跟踪:

                  #0/www/htdocs/w00a1ed7/autospin/redaktion/library/Zend/Session/Namespace.php(143):Zend_Session::start(true)

                  #0 /www/htdocs/w00a1ed7/autospin/redaktion/library/Zend/Session/Namespace.php(143): Zend_Session::start(true)

                  #1/www/htdocs/w00a1ed7/autospin/redaktion/library/Zend/Auth/Storage/Session.php(87):Zend_Session_Namespace->__construct('Zend_Auth')

                  #1 /www/htdocs/w00a1ed7/autospin/redaktion/library/Zend/Auth/Storage/Session.php(87): Zend_Session_Namespace->__construct('Zend_Auth')

                  #2/www/htdocs/w00a1ed7/autospin/redaktion/library/Zend/Auth.php(91):Zend_Auth_Storage_Session->__construct()

                  #2 /www/htdocs/w00a1ed7/autospin/redaktion/library/Zend/Auth.php(91): Zend_Auth_Storage_Session->__construct()

                  #3/www/htdocs/w00a1ed7/autospin/redaktion/library/Zend/Auth.php(141):Zend_Auth->getStorage()

                  #3 /www/htdocs/w00a1ed7/autospin/redaktion/library/Zend/Auth.php(141): Zend_Auth->getStorage()

                  #4/www/htdocs/w00a1ed7/autospin/redaktion/application/layouts/scripts/layout.phtml(31):Zend_Auth->hasIdentity()

                  #4 /www/htdocs/w00a1ed7/autospin/redaktion/application/layouts/scripts/layout.phtml(31): Zend_Auth->hasIdentity()

                  #5/www/htdocs/w00a1ed7/autospin/redaktion/library/Zend/View.php(108):包括('/www/htdocs/w00...')

                  #5 /www/htdocs/w00a1ed7/autospin/redaktion/library/Zend/View.php(108): include('/www/htdocs/w00...')

                  #6/www/htdocs/w00a1ed7/autospin/redaktion/library/Zend/View/Abstract.php(831):Zend_View->_run('/www/htdocs/w00...')

                  #6 /www/htdocs/w00a1ed7/autospin/redaktion/library/Zend/View/Abstract.php(831): Zend_View->_run('/www/htdocs/w00...')

                  #7/www/htdocs/w00a1ed 在/www/htdocs/w00a1ed7/autospin/redaktion/library/Zend/Session.php在线 462

                  #7 /www/htdocs/w00a1ed in /www/htdocs/w00a1ed7/autospin/redaktion/library/Zend/Session.php on line 462

                  我使用 Zend_Auth 并在我的本地服务器上运行良好,但在生产服务器上我收到了前面的错误,但不是每次都如此.

                  I Use Zend_Auth and on my local server and it works well, but on a production server I get the preceding error, but not every time.

                  我已检查 .htaccess 文件中的 session.autostart 是否设置为 0.

                  I have checked that session.autostart is set to 0 in the .htaccess file.

                  我该如何解决这个错误?

                  How do I fix this error?

                  感谢您的回答,但我不会在任何地方使用 session_start().仅与采埃孚合作.

                  Thank you for your Answer, but I do not user session_start() anywhere. Work only with ZF.

                  我只在共享服务器上遇到这个问题,在我的本地服务器脚本上运行完美.

                  I Have this Problem only on shared server, on my local server script works perfectly.

                  我在此代码中使用 INIT 函数:

                  I Use INIT Function with this code:

                  受保护的 $user;

                  protected $user;

                  public function init()
                  {   
                      if(!Zend_Auth::getInstance()->hasIdentity())
                      {
                          $this->_redirect('auth/login');
                      }else
                      {
                          $this->user = Zend_Auth::getInstance()->getIdentity();
                      }
                  }
                  

                  我已经尝试只在indexAction中设置tis代码,这样其他action就不用去破解Auth了...但是还是有问题.

                  I allready try to set tis code only in indexAction, so that other actions do not have to chack the Auth... but still have problems.

                  有没有办法在 Action 中设置不检查会话或类似这样的想法?

                  Ist there a way to set in an Action to do not check about session or somethink like this?

                  最好的问候

                  推荐答案

                  事情就是这样.Zend_Auth 尝试开始一个新的会话,因为 Zend_Session::start() 还没有被调用.

                  It's what it says it is. Zend_Auth tries to start a new session, since Zend_Session::start() has not yet been called.

                  问题是必须在会话开始之前调用 Zend_Session::start().但是,由于 session.autostart 是 0(顺便说一句,这是在 php.ini 中而不是 .htaccess 中),您可能已经编写了 session_start();某处.您不能这样做,因为 ZF 希望完全控制会话,即您不应直接访问全局会话变量.

                  The problem is that Zend_Session::start() has to be called before a session is started. But, since session.autostart is 0 (btw this is in php.ini not .htaccess), you have probably written session_start(); somewhere. You're not allowed to do that, since ZF wishes to have full control over sessions, i.e. you shouldn't access the global session variable directly.

                  要解决它,请在您的代码文件中搜索 session_start() 和其中之一

                  To solve it, search your code files for session_start() and either

                  1. 删除所有出现,但只有一个.要注意它是否已经启动,请设置 error_reporting(E_ALL|E_STRICT);
                  2. 在所有地方用 Zend_Session::start(); 替换它

                  如果你不能找到所有的出现,找到一个 session_start();这会困扰您的 Zend_Auth::getInstance()->hasIdentity() 并使用以下代码段快速解决问题

                  If you can't find all occurrences, find the one session_start(); that bothers your Zend_Auth::getInstance()->hasIdentity() and solve the problem quick n' dirty with the following snippet

                  try {
                      Zend_Session::start();
                  } catch(Zend_Session_Exception $e) {
                      session_start();
                  }
                  

                  如果您在整个应用程序中使用 ZF,我会选择 2)

                  If you're using ZF in your whole application, I would go with 2)

                  这篇关于“会话已经开始……"Zend Framework 应用程序中的异常的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

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

                  相关文档推荐

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

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

                  • <tfoot id='j7ywH'></tfoot>
                        <tbody id='j7ywH'></tbody>
                      <legend id='j7ywH'><style id='j7ywH'><dir id='j7ywH'><q id='j7ywH'></q></dir></style></legend>

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