久久久久久久av_日韩在线中文_看一级毛片视频_日本精品二区_成人深夜福利视频_武道仙尊动漫在线观看

  • <small id='UcoXz'></small><noframes id='UcoXz'>

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

    <legend id='UcoXz'><style id='UcoXz'><dir id='UcoXz'><q id='UcoXz'></q></dir></style></legend><tfoot id='UcoXz'></tfoot>

        Zend Framework:控制器對象中的 init() 和 preDispatch()

        Zend Framework: What are the differences between init() and preDispatch() functions in controller objects?(Zend Framework:控制器對象中的 init() 和 preDispatch() 函數有什么區別?)
        <i id='oLY3E'><tr id='oLY3E'><dt id='oLY3E'><q id='oLY3E'><span id='oLY3E'><b id='oLY3E'><form id='oLY3E'><ins id='oLY3E'></ins><ul id='oLY3E'></ul><sub id='oLY3E'></sub></form><legend id='oLY3E'></legend><bdo id='oLY3E'><pre id='oLY3E'><center id='oLY3E'></center></pre></bdo></b><th id='oLY3E'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='oLY3E'><tfoot id='oLY3E'></tfoot><dl id='oLY3E'><fieldset id='oLY3E'></fieldset></dl></div>
        <legend id='oLY3E'><style id='oLY3E'><dir id='oLY3E'><q id='oLY3E'></q></dir></style></legend>
        • <small id='oLY3E'></small><noframes id='oLY3E'>

            1. <tfoot id='oLY3E'></tfoot>
                <bdo id='oLY3E'></bdo><ul id='oLY3E'></ul>
                    <tbody id='oLY3E'></tbody>

                  本文介紹了Zend Framework:控制器對象中的 init() 和 preDispatch() 函數有什么區別?的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

                  問題描述

                  我認為執行的順序是init()、preDispatch()然后action()被調用.

                  1. 我是否應該在 init() 或 preDispatch() 中初始化我的變量,這些變量在所有操作中都很常見?我見過有人使用這兩個函數進行初始化.可能顧名思義,它應該在 init() 中完成,但是在 preDispatch() 中會發生什么樣的事情?

                  2. init() 和 preDispatch() 函數調用之間會發生什么?

                  解決方案

                  首先為 Zend_Controller_Plugin_Abstract 的實例調用 preDispatch().這里有請求和響應對象,因此您可以過濾請求或使用請求中的信息做一些準備.

                  Zend_Controller_Action

                  init() 接下來作為構造函數的一部分被調用.它可以幫助您初始化控制器,而無需覆蓋和重復構造函數的簽名(Zend_Controller_Action::__contruct()).

                  控制器的preDispatch() 方法在這里被調用.您可以調用 $request->setDispatched(false) 來跳過當前操作 - 不確定您是否可以在 init()

                  中執行此操作

                  然后調用您的操作方法(例如viewAction()).在這里,您可以執行正常的工作,例如從模型中獲取內容并填充視圖.

                  所以區別現在應該很清楚了:

                  • 如果您想在所有操作之前執行某些操作 - 將其放入插件并使用其中一個鉤子(除了 preDispatch() 之外,還有 routeStartup 和 其他),
                  • 如果你想在控制器中的每個動作之前 - initpreDispatch(),
                  • 如果僅針對單個操作 - 操作本身.
                  <塊引用>

                  init()preDispatch() 函數調用之間會發生什么?

                  幾乎什么都沒有 - preDispatch() 被執行了,如果你還沒有調用 $request->setDispatched(false),動作就會被執行.>

                  I think the order of execution is init(), preDispatch() and then action() is called.

                  1. Should I initialize my variables, which are common among all actions, in init() or preDispatch()? I've seen people using both functions for initialization. Probably as the name suggests it should be done in init() but then what kind of stuff would go in preDispatch()?

                  2. What happens between init() and preDispatch() function calls?

                  解決方案

                  First preDispatch() is called for instances of Zend_Controller_Plugin_Abstract. Here you have the request and response objects, so you might filter the request or do some preparation using the information from the request.

                  init() of the Zend_Controller_Action is called next as part of the constructor. It's there to help you initialize your controller, without having to override and repeat the signature of the constructor (Zend_Controller_Action::__contruct()).

                  The controller's preDispatch() method is called here. You can call $request->setDispatched(false) to skip the current action - not sure if you can do that in init()

                  Then your action method is called (viewAction() for example). Here you do your normal work like fetching stuff from the model and populating the view.

                  So the distinction should now be clear:

                  • If you want something to be executed before all actions - put it in a plugin and use one of the hooks (besides preDispatch() there is routeStartup and others),
                  • if you want before every action in a controller - init or preDispatch(),
                  • if only for a single action - the action itself.

                  What happens between init() and preDispatch() function calls?

                  Almost nothing - preDispatch() is executed, and if you haven't called $request->setDispatched(false), the action is executed.

                  這篇關于Zend Framework:控制器對象中的 init() 和 preDispatch() 函數有什么區別?的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!

                  【網站聲明】本站部分內容來源于互聯網,旨在幫助大家更快的解決問題,如果有圖片或者內容侵犯了您的權益,請聯系我們刪除處理,感謝您的支持!

                  相關文檔推薦

                  Deadlock exception code for PHP, MySQL PDOException?(PHP、MySQL PDOException 的死鎖異常代碼?)
                  PHP PDO MySQL scrollable cursor doesn#39;t work(PHP PDO MySQL 可滾動游標不起作用)
                  PHP PDO ODBC connection(PHP PDO ODBC 連接)
                  Using PDO::FETCH_CLASS with Magic Methods(使用 PDO::FETCH_CLASS 和魔術方法)
                  php pdo get only one value from mysql; value that equals to variable(php pdo 只從 mysql 獲取一個值;等于變量的值)
                  MSSQL PDO could not find driver(MSSQL PDO 找不到驅動程序)

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

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

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

                            主站蜘蛛池模板: 亚洲天堂中文字幕 | 日本粉嫩一区二区三区视频 | 91xxx在线观看 | 久久精品成人 | 夜夜爽99久久国产综合精品女不卡 | 色综合一区二区三区 | 国产精品久久久久久一区二区三区 | 欧美亚州 | 久久精品久久久久久 | 久久精品成人一区 | 欧美激情第一区 | 国产精品久久久久久一区二区三区 | 国产综合久久久 | 日韩欧美二区 | 久久久91 | 在线播放中文字幕 | 最新中文字幕久久 | 精品亚洲二区 | 日本精品999 | 丝袜美腿一区二区三区动态图 | 午夜久久久 | 深夜福利亚洲 | 日韩精品三区 | 亚洲精品视频导航 | 亚洲成人精品久久 | 日本在线一区二区 | 精品国产一区二区三区在线观看 | 羞羞的视频在线 | 精品久久久久久久久亚洲 | 天天插天天操 | 国内精品久久久久久久影视简单 | 亚洲成av片人久久久 | 久久久久成人精品 | 国产日韩精品一区 | 亚洲精品乱码久久久久久按摩观 | 日韩毛片在线观看 | 国精品一区 | 日本一区二区不卡 | 美日韩中文字幕 | 国产一区二区三区视频在线观看 | 欧美精品一区二区三区四区五区 |