<legend id='b6u7D'><style id='b6u7D'><dir id='b6u7D'><q id='b6u7D'></q></dir></style></legend>

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

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

      • <bdo id='b6u7D'></bdo><ul id='b6u7D'></ul>

        <tfoot id='b6u7D'></tfoot>

        在 Zend Framework 中处理会话的最佳方式

        Best way to deal with session handling in Zend Framework(在 Zend Framework 中处理会话的最佳方式)
          <legend id='cjn17'><style id='cjn17'><dir id='cjn17'><q id='cjn17'></q></dir></style></legend>

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

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

                  <tbody id='cjn17'></tbody>
                <i id='cjn17'><tr id='cjn17'><dt id='cjn17'><q id='cjn17'><span id='cjn17'><b id='cjn17'><form id='cjn17'><ins id='cjn17'></ins><ul id='cjn17'></ul><sub id='cjn17'></sub></form><legend id='cjn17'></legend><bdo id='cjn17'><pre id='cjn17'><center id='cjn17'></center></pre></bdo></b><th id='cjn17'></th></span></q></dt></tr></i><div id='cjn17'><tfoot id='cjn17'></tfoot><dl id='cjn17'><fieldset id='cjn17'></fieldset></dl></div>
                1. 本文介绍了在 Zend Framework 中处理会话的最佳方式的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  所以我开始使用 Zend 框架并希望实现一个站点范围的用户"会话......我可以从应用程序中的所有模块/控制器轻松访问它.

                  So I'm starting up in Zend framework and looking to implement a site-wide "User" session.... something I can easily access from ALL modules/controllers in the application.

                  我想,我应该在库中创建一个新的命名空间并扩展控制器,例如:

                  I'm like, should I make a new namespace in the library and extend the controller, like:

                  class MYCUSTOMLIB_Controller_Action extends Zend_Controller_Action
                  {
                      protected $_userSession;
                  
                      function preDispatch(Zend_Controller_Request_Abstract $req)
                      {
                           $this->_userSession = new Zend_Session_Namespace('user');
                      }
                  }
                  

                  然后我所有的控制器/模块/等都从那里扩展?

                  ANd then have all my controllers/modules/etc extend from that?

                  或者我应该创建一个插件还是什么?你会如何让这个插件将用户会话传递给控制器?

                  Or should I create a Plugin or what? How would you go about making this plugin to pass the user session to the controller?

                  还是我在引导程序中执行?再次如何传递给控制器?

                  Or do I do it in the bootstrap?? Again how to pass to controller?

                  我也应该使用 Zend_Session_Namespace 或 Zend_Http_Cookie 以及如何加密和 xss 清理 cookie 还是自动完成?

                  Also should I use Zend_Session_Namespace or Zend_Http_Cookie and also how do I encrypt and xss clean the cookie or is that done automagically?

                  推荐答案

                  我也会在引导程序中初始化:

                  I would initialise in the bootstrap too:

                  //Bootstrap.php
                  protected function _initUserSession()
                  {
                      return new Zend_Session_Namespace('user');
                  }
                  

                  然后我会使用一个动作助手:

                  Then I would use an action helper:

                  // library/App/Controller/Action/Helper/Session.php
                  class App_Controller_Action_Helper_Session extends Zend_Controller_Action_Helper_Abstract
                  {
                      function direct()
                      {
                          return $this->getFrontController()->getParam('userSession');
                      }
                  }
                  

                  您可以像这样在控制器中访问它:

                  You access it in your controller like this:

                  function indexAction()
                  {
                      $session = $this->_helper->session;
                  }
                  

                  这篇关于在 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 的问题)

                          <tbody id='DGKFS'></tbody>

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

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

                          • <tfoot id='DGKFS'></tfoot>