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

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

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

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

    1. 如何設置分層 Zend 休息路線?

      How to set up Hierarchical Zend Rest Routes?(如何設置分層 Zend 休息路線?)
      <tfoot id='k9qRz'></tfoot>

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

            <tbody id='k9qRz'></tbody>

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

              1. 本文介紹了如何設置分層 Zend 休息路線?的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

                問題描述

                使用 Zend 框架,我嘗試在按以下模式組織的資源上為 REST api 構建路由:

                • http://example.org/users/
                • http://example.org/users/234
                • http://example.org/users/234/items
                • http://example.org/users/234/items/34

                我如何使用 Zend_Rest_Route 進行設置?

                這是我在 bootstrap.php 文件中為用戶資源 (users/:id) 設置路由的方法:

                 $this->bootstrap('frontController');$frontController = Zend_Controller_Front::getInstance();$restRoute = new Zend_Rest_Route($frontController);$frontController->getRouter()->addRoute('default', $restRoute);

                [據我所知,這是一個包羅萬象的路線,因此 users/324/items/34 將導致參數設置為 id=324 和 items=34,并且所有內容都將映射到用戶(前端模塊)模型.從那里我想我可以只測試 items 參數并在 get 請求中為用戶 #324 檢索項目 #34.]<=== 我剛剛檢查了它,它似乎不是這樣工作的:

                訪問/users/234/items/43 和

                var_dump($this->_getAllParams());

                在其余控制器的 get 操作中產生以下輸出:

                array(4) {[控制器"]=>字符串(5)用戶"[動作"]=>字符串(3)獲取"[2]=>string(5) "items" ["module"]=>字符串(7)默認"]}

                不知何故,兩個 ID 都丟失了...

                有人嗎?

                解決方案

                AFAIK,Zend_Rest_Route 中沒有允許您執行此類操作的功能.有一個提案,但不確定何時實施.您可以將其添加到 Bootstrap 中以設置此自定義路由.

                $front = $this->getResource('FrontController');$testRoute = new Zend_Controller_Router_Route('users/:user_id/items/:item_id',大批('控制器' =>'用戶','動作' =>'物品','模塊' =>'默認'));$front->getRouter()->addRoute('test', $testRoute);

                user_iditem_id 在 UsersController 的 itemAction 中作為參數可用:

                $user_id = $this->_request->getParam('user_id');

                With the Zend Framework, I am trying to build routes for a REST api on resources organized in the following pattern:

                • http://example.org/users/
                • http://example.org/users/234
                • http://example.org/users/234/items
                • http://example.org/users/234/items/34

                How do I set up this with Zend_Rest_Route?

                Here is how I have setup the route for the users resource (users/:id) in my bootstrap.php file:

                  $this->bootstrap('frontController');
                  $frontController = Zend_Controller_Front::getInstance();
                  $restRoute = new Zend_Rest_Route($frontController);
                  $frontController->getRouter()->addRoute('default', $restRoute);
                

                [As far as I understand, this is a catch all route so users/324/items/34 would results in parameters set as id=324 and items=34 and everything would be mapped to the Users (front module) Model. From there I guess I could just test for the items parameter and retrieve the item #34 for user #324 on a get request.]<=== I just checked it and it doesn't seems to work like that:

                Acessing /users/234/items/43 and

                var_dump($this->_getAllParams());
                

                in the get action of the rest controller results in the following output:

                array(4) {
                 ["controller"]=> string(5) "users"
                 ["action"]=>  string(3) "get"
                 [2]=>  string(5) "items"  ["module"]=>  string(7) "default"]
                }
                

                Somehow both ids got lost...

                Anyone?

                解決方案

                AFAIK, there is no feature in Zend_Rest_Route which allows you to do something like this. There is a proposal but not sure when it'll be implemented. You can add this in your Bootstrap to set up this custom route.

                $front = $this->getResource('FrontController'); 
                $testRoute = new Zend_Controller_Router_Route(
                    'users/:user_id/items/:item_id',
                    array(
                        'controller' => 'users',
                        'action' => 'item',
                        'module' => 'default'
                    )
                );
                
                $front->getRouter()->addRoute('test', $testRoute);
                

                user_id or item_id become available in itemAction in UsersController as parameters:

                $user_id = $this->_request->getParam('user_id');
                

                這篇關于如何設置分層 Zend 休息路線?的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持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 找不到驅動程序)

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

                    1. <small id='X93sY'></small><noframes id='X93sY'>

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

                        <legend id='X93sY'><style id='X93sY'><dir id='X93sY'><q id='X93sY'></q></dir></style></legend>
                          主站蜘蛛池模板: 九色一区 | 一级毛片在线视频 | 国产原创视频 | 在线一区视频 | 国产第一页在线观看 | 在线观看欧美日韩视频 | 欧美精品一区在线发布 | 精品国产免费人成在线观看 | 一区二区免费在线视频 | 综合久久av| 日韩一区二区三区在线 | 欧美日韩三级 | 欧美精品91爱爱 | 精品国产鲁一鲁一区二区张丽 | 国产精品综合色区在线观看 | 一区二区三区视频在线观看 | 成人精品视频99在线观看免费 | 成人一区二区三区 | 99久久国产综合精品麻豆 | av一二三区 | 日韩在线播放网址 | 中文字字幕一区二区三区四区五区 | 国产伦一区二区三区视频 | a级片www| 国产欧美日韩一区二区三区在线 | 国产午夜影院 | 日韩精品免费在线观看 | 日韩成人一区二区 | 久久国产精品久久久久久久久久 | 香蕉久久网 | 久久国产婷婷国产香蕉 | 国产高清一区二区 | jlzzjlzz欧美大全 | 日本黄色大片免费 | 亚洲小视频在线播放 | 成人免费视频网站在线看 | 国产三级精品三级在线观看四季网 | 免费看爱爱视频 | 91私密视频| www.久久久.com| 久久婷婷麻豆国产91天堂 |