pbootcms网站模板|日韩1区2区|织梦模板||网站源码|日韩1区2区|jquery建站特效-html5模板网

  • <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="gms2y2s" 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="uo2a42o" 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="2o2yk2e" 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'>

                            主站蜘蛛池模板: SEO网站优化,关键词排名优化,苏州网站推广-江苏森歌网络 | 品牌设计_VI设计_电影海报设计_包装设计_LOGO设计-Bacross新越品牌顾问 | 复合肥,化肥厂,复合肥批发,化肥代理,复合肥品牌-红四方 | 智成电子深圳tdk一级代理-提供TDK电容电感贴片蜂鸣器磁芯lambda电源代理经销,TDK代理商有哪些TDK一级代理商排名查询。-深圳tdk一级代理 | PC构件-PC预制构件-构件设计-建筑预制构件-PC构件厂-锦萧新材料科技(浙江)股份有限公司 | 北京发电机出租_发电机租赁_北京发电机维修 - 河北腾伦发电机出租 | 深圳激光打标机_激光打标机_激光焊接机_激光切割机_同体激光打标机-深圳市创想激光科技有限公司 深圳快餐店设计-餐饮设计公司-餐饮空间品牌全案设计-深圳市勤蜂装饰工程 | 干式变压器厂_干式变压器厂家_scb11/scb13/scb10/scb14/scb18干式变压器生产厂家-山东科锐变压器有限公司 | 国际高中-国际学校-一站式择校服务-远播国际教育 | 东莞市海宝机械有限公司-不锈钢分选机-硅胶橡胶-生活垃圾-涡电流-静电-金属-矿石分选机 | 礼至家居-全屋定制家具_一站式全屋整装_免费量房设计报价 | 临时厕所租赁_玻璃钢厕所租赁_蹲式|坐式厕所出租-北京慧海通 | 智成电子深圳tdk一级代理-提供TDK电容电感贴片蜂鸣器磁芯lambda电源代理经销,TDK代理商有哪些TDK一级代理商排名查询。-深圳tdk一级代理 | 热熔胶网膜|pes热熔网膜价格|eva热熔胶膜|热熔胶膜|tpu热熔胶膜厂家-苏州惠洋胶粘制品有限公司 | 儿童乐园|游乐场|淘气堡招商加盟|室内儿童游乐园配套设备|生产厂家|开心哈乐儿童乐园 | 车辆定位管理系统_汽车GPS系统_车载北斗系统 - 朗致物联 | 棕刚玉-白刚玉厂家价格_巩义市东翔净水材料厂 | 锂电混合机-新能源混合机-正极材料混料机-高镍,三元材料混料机-负极,包覆混合机-贝尔专业混合混料搅拌机械系统设备厂家 | 南溪在线-南溪招聘找工作、找房子、找对象,南溪综合生活信息门户! | 膜片万向弹性联轴器-冲压铸造模具「沧州昌运模具」 | 番茄畅听邀请码怎么输入 - Dianw8.com| led太阳能路灯厂家价格_风光互补庭院灯_农村市政工程路灯-中山华可路灯品牌 | 动库网动库商城-体育用品专卖店:羽毛球,乒乓球拍,网球,户外装备,运动鞋,运动包,运动服饰专卖店-正品运动品网上商城动库商城网 - 动库商城 | 广东健伦体育发展有限公司-体育工程配套及销售运动器材的体育用品服务商 | 胃口福饺子加盟官网_新鲜现包饺子云吞加盟 - 【胃口福唯一官网】 | 扫地车厂家-山西洗地机-太原电动扫地车「大同朔州吕梁晋中忻州长治晋城洗地机」山西锦力环保科技有限公司 | 盘扣式脚手架-附着式升降脚手架-移动脚手架,专ye承包服务商 - 苏州安踏脚手架工程有限公司 | 龙门加工中心-数控龙门加工中心厂家价格-山东海特数控机床有限公司_龙门加工中心-数控龙门加工中心厂家价格-山东海特数控机床有限公司 | 水平筛厂家-三轴椭圆水平振动筛-泥沙震动筛设备_山东奥凯诺矿机 包装设计公司,产品包装设计|包装制作,包装盒定制厂家-汇包装【官方网站】 | 品牌策划-品牌设计-济南之式传媒广告有限公司官网-提供品牌整合丨影视创意丨公关活动丨数字营销丨自媒体运营丨数字营销 | 高空重型升降平台_高空液压举升平台_高空作业平台_移动式升降机-河南华鹰机械设备有限公司 | 湖南印刷厂|长沙印刷公司|画册印刷|挂历印刷|台历印刷|杂志印刷-乐成印刷 | 耐高温电缆厂家-远洋高温电缆 | 无味渗透剂,泡沫抑尘剂,烷基糖苷-威海威能化工有限公司 | 低浓度恒温恒湿称量系统,强光光照培养箱-上海三腾仪器有限公司 | 十二星座查询(性格特点分析、星座运势解读) - 玄米星座网 | 冻干机(冷冻干燥机)_小型|实验型|食品真空冷冻干燥机-松源 | 寮步纸箱厂_东莞纸箱厂 _东莞纸箱加工厂-东莞市寮步恒辉纸制品厂 | 内六角扳手「厂家」-温州市威豪五金工具有限公司 | 洗瓶机厂家-酒瓶玻璃瓶冲瓶机-瓶子烘干机-封口旋盖压盖打塞机_青州惠联灌装机械 | 重庆波纹管|重庆钢带管|重庆塑钢管|重庆联进管道有限公司 |