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

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

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

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

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

        如何使用zend框架獲取像mydomain.com/username這樣的動(dòng)

        how to get dynamic URL like mydomain.com/username using zend framework(如何使用zend框架獲取像mydomain.com/username這樣的動(dòng)態(tài)URL)
        <i id='qjX7R'><tr id='qjX7R'><dt id='qjX7R'><q id='qjX7R'><span id='qjX7R'><b id='qjX7R'><form id='qjX7R'><ins id='qjX7R'></ins><ul id='qjX7R'></ul><sub id='qjX7R'></sub></form><legend id='qjX7R'></legend><bdo id='qjX7R'><pre id='qjX7R'><center id='qjX7R'></center></pre></bdo></b><th id='qjX7R'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='qjX7R'><tfoot id='qjX7R'></tfoot><dl id='qjX7R'><fieldset id='qjX7R'></fieldset></dl></div>
          <legend id='qjX7R'><style id='qjX7R'><dir id='qjX7R'><q id='qjX7R'></q></dir></style></legend>
        1. <small id='qjX7R'></small><noframes id='qjX7R'>

                <tbody id='qjX7R'></tbody>

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

                  本文介紹了如何使用zend框架獲取像mydomain.com/username這樣的動(dòng)態(tài)URL的處理方法,對(duì)大家解決問(wèn)題具有一定的參考價(jià)值,需要的朋友們下面隨著小編來(lái)一起學(xué)習(xí)吧!

                  問(wèn)題描述

                  我正在使用 zend 框架開(kāi)發(fā)應(yīng)用程序.在應(yīng)用程序中,我必須為每個(gè)用戶提供一個(gè) URL,例如 mydomain.com/[username] 然后 public 將能夠查看他的個(gè)人資料.[username] 是特定用戶的用戶名

                  I am developing an application using zend framework. In the application I have to provide a URL for each user like mydomain.com/[username] then public will be able to view his profile. [username] is the username of the particular user

                  但是我怎樣才能做到這一點(diǎn)?我認(rèn)為在 ZF mydomain.com/username 中嘗試獲取名稱為 username 的控制器,但我應(yīng)該在此 URL 中顯示用戶配置文件,并且如果其他內(nèi)容如 mydomain.com 出現(xiàn),它必須轉(zhuǎn)到正確的控制器/控制器1

                  But how can I achieve this ? I think in ZF mydomain.com/username tries to get the controller with name username, but I should show user profiles in this URL and it must goes to the right controller if something else comein like mydomain.com/controller1

                  推薦答案

                  這個(gè)好像有點(diǎn)多,有幾個(gè)選項(xiàng):

                  This seems to come up quite a bit, there are a few options:

                  選項(xiàng) 1:自定義路由類

                  我已經(jīng)發(fā)表了一篇博客文章,其中詳細(xì)介紹了如何使用自定義路由類在 ZF 中實(shí)現(xiàn)此目的,請(qǐng)參閱:

                  I've put up a blog post with a detailed example of how to achieve this in ZF using a custom route class, see:

                  http://tfountain.co.uk/blog/2010/9/9/vanity-urls-zend-framework

                  這可能不是最簡(jiǎn)單的方法,但在我看來(lái)這是最好的方法,因?yàn)樗试S您像其他任何方法一樣設(shè)置用戶名路由,并且您仍然可以使用標(biāo)準(zhǔn)的 ZF URL 幫助程序和其他路由工具.

                  This might not be the simplest approach, but in my opinion it is the best, as it allows you to setup a username route like any other, and you can still use the standard ZF URL helpers and other routing toys.

                  選項(xiàng) 2:擴(kuò)展路由器

                  另一種方法是擴(kuò)展標(biāo)準(zhǔn) ZF 路由器,然后在做任何其他事情之前檢查用戶名路由.類似的東西:

                  Another approach is to extend the standard ZF router and then check for a username route before doing anything else. Something like:

                  class My_Router extends Zend_Controller_Router_Rewrite
                  {
                      public function route(Zend_Controller_Request_Abstract $request)
                      {
                          $pathBits = explode('/', $request->getPathInfo());
                          if (!empty($pathBits[0])) {
                              // check whether $pathBits[0] is a username here
                              // with a database lookup, if yes, set params and return
                          }
                  
                          // fallback on the standard ZF router
                          return parent::route($request);
                      }
                  }
                  

                  然后您需要告訴前端控制器使用您的路由器而不是默認(rèn)路由器,因此在您的引導(dǎo)程序中:

                  You then need to tell the front controller to use your router instead of the default one, so in your bootstrap:

                  protected function _initRoutes()
                  {
                      Zend_Controller_Front::getInstance()->setRouter(new My_Router());
                  }
                  

                  將My"替換為您的應(yīng)用程序自己的命名空間.

                  replace 'My' with your application's own namespace.

                  如果你采用這種方法,你就不能為你的用戶名路由使用 URL 助手,如果你開(kāi)始需要添加其他自定義功能,事情會(huì)變得有點(diǎn)混亂,所以改用自定義路由類.

                  If you follow this approach you can't use the URL helper for your username routes, and things can become a bit messy if you start needing to add other custom functionality, so go with the custom route class instead.

                  這篇關(guān)于如何使用zend框架獲取像mydomain.com/username這樣的動(dòng)態(tài)URL的文章就介紹到這了,希望我們推薦的答案對(duì)大家有所幫助,也希望大家多多支持html5模板網(wǎng)!

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

                  相關(guān)文檔推薦

                  Deadlock exception code for PHP, MySQL PDOException?(PHP、MySQL PDOException 的死鎖異常代碼?)
                  PHP PDO MySQL scrollable cursor doesn#39;t work(PHP PDO MySQL 可滾動(dòng)游標(biāo)不起作用)
                  PHP PDO ODBC connection(PHP PDO ODBC 連接)
                  Using PDO::FETCH_CLASS with Magic Methods(使用 PDO::FETCH_CLASS 和魔術(shù)方法)
                  php pdo get only one value from mysql; value that equals to variable(php pdo 只從 mysql 獲取一個(gè)值;等于變量的值)
                  MSSQL PDO could not find driver(MSSQL PDO 找不到驅(qū)動(dòng)程序)
                    <bdo id='F5XMT'></bdo><ul id='F5XMT'></ul>
                    <i id='F5XMT'><tr id='F5XMT'><dt id='F5XMT'><q id='F5XMT'><span id='F5XMT'><b id='F5XMT'><form id='F5XMT'><ins id='F5XMT'></ins><ul id='F5XMT'></ul><sub id='F5XMT'></sub></form><legend id='F5XMT'></legend><bdo id='F5XMT'><pre id='F5XMT'><center id='F5XMT'></center></pre></bdo></b><th id='F5XMT'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='F5XMT'><tfoot id='F5XMT'></tfoot><dl id='F5XMT'><fieldset id='F5XMT'></fieldset></dl></div>

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

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

                        • <tfoot id='F5XMT'></tfoot>
                            <tbody id='F5XMT'></tbody>

                            主站蜘蛛池模板: 日韩在线观看视频一区 | 成人亚洲网 | 91久久精| 在线免费观看黄色av | 国产精品久久片 | 日韩免费一区 | 精精久久 | 精品乱码一区二区 | 国产91在线播放 | 91在线免费视频 | 中文字幕精品一区二区三区精品 | 亚洲三区在线 | 欧美精品1区2区 | 久久久久国产一区二区三区四区 | 亚洲欧美精品国产一级在线 | 免费一级毛片 | 四虎网站在线观看 | 亚洲一区二区网站 | 91玖玖| 黄色永久免费 | 黑人精品欧美一区二区蜜桃 | 久久成人精品视频 | www.99精品| 亚洲综合大片69999 | 神马影院一区二区三区 | 欧美精品欧美精品系列 | 亚洲精品久久久蜜桃 | 先锋资源站 | 黄色免费av | 国产区一区 | 一区二区三区日本 | 中文字幕亚洲无线 | 欧美日韩在线精品 | 国产一区二区影院 | 国产精品国产成人国产三级 | 国产精品久久久久不卡 | 午夜国产羞羞视频免费网站 | 又黄又爽的网站 | 免费看a| 成人福利网站 | 91中文字幕 |