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

      <small id='1Uovr'></small><noframes id='1Uovr'>

      <tfoot id='1Uovr'></tfoot>
      <i id='1Uovr'><tr id='1Uovr'><dt id='1Uovr'><q id='1Uovr'><span id='1Uovr'><b id='1Uovr'><form id='1Uovr'><ins id='1Uovr'></ins><ul id='1Uovr'></ul><sub id='1Uovr'></sub></form><legend id='1Uovr'></legend><bdo id='1Uovr'><pre id='1Uovr'><center id='1Uovr'></center></pre></bdo></b><th id='1Uovr'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='1Uovr'><tfoot id='1Uovr'></tfoot><dl id='1Uovr'><fieldset id='1Uovr'></fieldset></dl></div>
      <legend id='1Uovr'><style id='1Uovr'><dir id='1Uovr'><q id='1Uovr'></q></dir></style></legend>
        <bdo id='1Uovr'></bdo><ul id='1Uovr'></ul>
    1. Zend Framework 中的簡單重寫

      Simple rewrites in Zend Framework(Zend Framework 中的簡單重寫)

          <bdo id='Up1Jy'></bdo><ul id='Up1Jy'></ul>

          1. <tfoot id='Up1Jy'></tfoot>

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

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

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

                本文介紹了Zend Framework 中的簡單重寫的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

                問題描述

                這似乎是一個非常簡單的問題,但我只找到了復雜的答案.我有一個需要用戶登錄的 Zend Framework 應用程序.loginAction()logoutAction()AuthController 中定義.我想允許用戶通過 http://www.example.com/login 而不是 登錄 rel="nofollow">http://www.example.com/auth/login.

                This seems like a very simple question, but I've only found complicated answers. I've got a Zend Framework application that requires users to login. The loginAction() and logoutAction() are defined in AuthController. I want to allow users to login via http://www.example.com/login rather than http://www.example.com/auth/login.

                我知道有很多方法可以做到這一點,我考慮過的 3 種方法是:

                I know there are numerous ways of doing this, the 3 I've considered are:

                1. .htaccess 重寫
                2. 創建 LoginController 并將 indexAction() 重定向到 auth/login
                3. 使用 Zend_Controller_Router_Rewrite 定義我自己的路由.

                如果可能的話,我寧愿將它排除在 #1 之外.#2 很容易理解,雖然它看起來像一個黑客.它還可能會用一堆 5 行控制器"類來混淆代碼.我認為 #3 是要走的路,但我不完全了解如何有效地使用它.我試過 使用 Zend_ConfigRewriteRouter 雖然我只定義了登錄路由,所以每個鏈接都變成了/login"(我想我錯過了一個默認路由).我在 Bootstrap.php 中做了這個,我不確定那是否正確.

                I'd rather keep it out of #1 if possible. #2 is easy enough to understand, although it seems like a hack. It also could clutter the code with a bunch of 5-line "Controller" classes. I think #3 is the way to go but I don't fully understand how to use it effectively. I have tried Using Zend_Config with the RewriteRouter although I only defined the login route so every link became '/login' (I think I was missing a default route). I did this in my Bootstrap.php, I'm not sure if that was correct.

                有沒有我遺漏的簡單方法?我是否錯誤地使用了#3?是否有我應該閱讀的教程?(我看過 Zend 文檔,這很好,但我經常發現自己在問,'這段代碼應該放在哪里:在控制器、模型、引導程序中,還是在其他中?')

                Is there a simple approach I'm missing? Am I using #3 incorrectly? Are there tutorials for this that I should read? (I've looked at the Zend documentation which is good but often I find myself asking, 'Where should this code go: in a controller, model, bootstrap, other?')

                推薦答案

                對于一個定義的目的,比如你有一個 命名" 路由,這將是最簡單的方法.雖然實現命名路由的方法有很多種,但最簡單的方法是將它放在 application.ini 中:

                for a defined purpose like you have a "named" route would be the simplest way to do it. While there are any number of ways to implement a named route the easiest is to put it in the application.ini:

                    // /application/configs/application.ini
                    resources.router.routes.login.route = /login
                    resources.router.routes.login.defaults.module = default
                    resources.router.routes.login.defaults.controller = auth
                    resources.router.routes.login.defaults.action = login
                

                把它放在你的引導程序中并沒有錯,只是對我來說似乎不太方便.
                同樣這樣做應該(不保證)防止默認路由出現任何問題.

                putting it in your bootstrap is not wrong, it just doesn't seem as convienient to me.
                Also doing it this way should (no guarantees) prevent any problems with the default routes.

                當使用 url() 助手調用路由時,重要的是要記住使用命名路由:

                When calling a route using the url() helper it is important to remember to use either the named route :

                <?php echo $this->url(array(), 'routeName') ?>
                

                或者如果你需要傳遞普通的 'controller' => , 'action' => :

                or if you need to pass the normal 'controller' => , 'action' => :

                <?php echo $this->url(array('controller' => 'index', 'action' => 'index'), 'default') ?>
                

                near as I can tell 'default' in this context 表示這將是 Zend/Controller/Router/Route/Module.php 中定義的默認路由

                near as I can tell 'default' in this context indicates this would be a default route as defined in Zend/Controller/Router/Route/Module.php

                這篇關于Zend Framework 中的簡單重寫的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持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 找不到驅動程序)

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

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

                  <tbody id='q9hJm'></tbody>
                • <bdo id='q9hJm'></bdo><ul id='q9hJm'></ul>

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

                        • 主站蜘蛛池模板: 久草在线影| 国产午夜三级一区二区三 | 欧美日韩国产一区二区三区不卡 | 国产黄色av电影 | 拍真实国产伦偷精品 | 国产女人与拘做受免费视频 | 亚洲传媒在线 | 欧美一级欧美一级在线播放 | 精品一区二区三区四区 | 国产精品久久久久久久久久 | 国产免费一区 | 黄色大全免费看 | 亚洲国产精品久久久久秋霞不卡 | 国产农村妇女毛片精品久久麻豆 | 天天天操天天天干 | 欧洲尺码日本国产精品 | 国产精品久久福利 | 中文字幕视频在线观看 | 欧美日韩亚洲视频 | 嫩草视频在线免费观看 | 久久久久资源 | 色毛片| 天色综合网| 成人av播放 | 亚洲成人精品在线观看 | 日韩一区二区三区视频在线播放 | 欧美 日韩 中文 | 狠狠色综合网站久久久久久久 | 最新国产在线 | 91精品国产一二三 | 亚洲综合色视频在线观看 | 色婷婷亚洲一区二区三区 | 激情网站在线 | 国产xxxx搡xxxxx搡麻豆 | 91国内外精品自在线播放 | 国产精品区一区二区三区 | 久久99精品久久久久久 | www精品美女久久久tv | 久草久草久草 | 天堂久久久久久久 | 亚洲成人国产 |