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

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

      <bdo id='ZH0Kp'></bdo><ul id='ZH0Kp'></ul>
      <legend id='ZH0Kp'><style id='ZH0Kp'><dir id='ZH0Kp'><q id='ZH0Kp'></q></dir></style></legend>
      <i id='ZH0Kp'><tr id='ZH0Kp'><dt id='ZH0Kp'><q id='ZH0Kp'><span id='ZH0Kp'><b id='ZH0Kp'><form id='ZH0Kp'><ins id='ZH0Kp'></ins><ul id='ZH0Kp'></ul><sub id='ZH0Kp'></sub></form><legend id='ZH0Kp'></legend><bdo id='ZH0Kp'><pre id='ZH0Kp'><center id='ZH0Kp'></center></pre></bdo></b><th id='ZH0Kp'></th></span></q></dt></tr></i><div id='ZH0Kp'><tfoot id='ZH0Kp'></tfoot><dl id='ZH0Kp'><fieldset id='ZH0Kp'></fieldset></dl></div>

    1. Zend_Controller_Router_Exception:“xyz";未指定

      时间:2023-05-31
    2. <legend id='JqCFm'><style id='JqCFm'><dir id='JqCFm'><q id='JqCFm'></q></dir></style></legend>
        <tbody id='JqCFm'></tbody>

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

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

                本文介绍了Zend_Controller_Router_Exception:“xyz";未指定的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                问题描述

                我当前的 Zend Framework 应用程序有问题.

                I have a problem in my current Zend Framework application.

                在我的 Bootstrap 中,我注册了这些路由:

                In my Bootstrap I register these routes:

                protected function _initRouter()
                {
                    $this->bootstrap("FrontController");
                    $frontController = $this->getResource("FrontController");
                
                    $route = new Zend_Controller_Router_Route(
                        ":module/:id",
                        array(
                            "controller" => "index",
                            "action" => "index"
                            ),
                        array("id" => "d+")
                        );
                    $frontController->getRouter()->addRoute('shortcutOne', $route);
                
                    $route = new Zend_Controller_Router_Route(
                        ":module/:controller/:id",
                        array("action" => "index"),
                        array("id" => "d+")
                        );
                    $frontController->getRouter()->addRoute('shortcutTwo', $route);
                
                    $route = new Zend_Controller_Router_Route(
                        ":module/:controller/:action/:id",
                        null,
                        array("id" => "d+", "action" => "w+")
                        );
                    $frontController->getRouter()->addRoute('shortcutThree', $route);
                }
                

                现在我将 Zend_Navigation 添加到我的项目中.我有几个模块,它们在模块引导程序中注册导航元素:

                Now later I added Zend_Navigation to my project. I have several modules, that register navigation elements in the module bootstrap:

                <?php
                
                class Contact_Bootstrap extends Zend_Application_Module_Bootstrap
                {
                    protected function _initNavigation()
                    {
                        $layout = $this->getApplication()->getResource("layout");
                        $view = $layout->getView();
                
                        $config = new Zend_Config_Xml(dirname(__FILE__)."/config/navigation.xml", "nav");
                
                        $view->navigation()->addPage($config);
                    }
                }
                

                当我在浏览器中打开应用程序时,一切正常.这意味着我可以看到导航并单击其链接以查看指定页面.但是当我点击一个使用 :module/:action/:id 路由的页面时,导航助手会抛出一个 Zend_Controller_Router_Route 异常:

                When I open the app in my browser everything works fine. That means I can see the navigation and click on its links to view the specified page. But when I hit a page that uses the :module/:action/:id route, the Navigation Helper throws a Zend_Controller_Router_Route exception:

                致命错误:Zend_Controller_Router_Exception: id is not specified in C:Entwicklungkt runksrclibraryendViewHelperNavigationHelperAbstract.php 第 519 行

                Fatal error: Zend_Controller_Router_Exception: id is not specified in C:Entwicklungkt runksrclibraryendViewHelperNavigationHelperAbstract.php on line 519

                你们中有人也遇到过这个错误吗?如果你能帮助我或给我建议,那就太好了.另外,如果您需要有关我的设置等的更多信息,请告诉我.

                Did anyone of you experience this error too? It would be great if you could help me or give me advise. Also if you need more information on my setup etc., just tell me.

                谢谢!

                推荐答案

                我自己找到了解决方案.

                I found the solution myself.

                这个问题是由于 Zend_Navigation 元素的一个不那么有利的行为引起的.在他们的 getHref() 方法中,他们使用了 URL 助手.此帮助程序创建导航条目必须链接到的 URL,采用为导航元素(模块、控制器、操作等)指定的参数.

                This problem was caused due to a not-so-beneficial behavior of the Zend_Navigation elements. In their getHref() method they use the URL helper. This helper creates the URL the navigation entry has to link to, taking in the arguments specified for the navigation element (module, controller, action, etc.)

                现在,问题是,例如,如果您像我一样在引导程序中创建了自定义路由

                Now, the problem is that, if you have created a custom route in your bootstrap just as I did, for example

                ":module/:controller/:id"
                

                您遇到的问题是,当使用此路由时,URL 帮助程序使用该路由生成导航条目的链接.但是,我没有传递额外的id"参数,所以我得到了异常.

                You run into the problem that when this route is being used, the URL helper uses that route to generate the link for the navigation entry. However, I did not pass on an additional "id" parameter, so I got the exception.

                因此,一种解决方案是为每个 Zend_Navigation_Page_Mvc 实例路由"传递一个附加参数,该参数设置为默认".

                So one solution is to pass an additional parameter for each Zend_Navigation_Page_Mvc instance "route" which is set to "default".

                我还没有尝试过的另一种解决方案是让新的自定义路由将自身重新映射到默认路由上,例如:

                Another solution, which I didn't try yet, is to let the new custom route just re-map itself onto the default route, like:

                ":module/:controller/:action/id/$id"
                

                但我不知道您是否有能力使用 Zend Framework 做到这一点.

                But I don't know if you have the ability with Zend Framework to do that.

                这篇关于Zend_Controller_Router_Exception:“xyz";未指定的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                上一篇:Zend_Db_Table 子查询 下一篇:没有了

                相关文章

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

                  2. <i id='1ojJr'><tr id='1ojJr'><dt id='1ojJr'><q id='1ojJr'><span id='1ojJr'><b id='1ojJr'><form id='1ojJr'><ins id='1ojJr'></ins><ul id='1ojJr'></ul><sub id='1ojJr'></sub></form><legend id='1ojJr'></legend><bdo id='1ojJr'><pre id='1ojJr'><center id='1ojJr'></center></pre></bdo></b><th id='1ojJr'></th></span></q></dt></tr></i><div id='1ojJr'><tfoot id='1ojJr'></tfoot><dl id='1ojJr'><fieldset id='1ojJr'></fieldset></dl></div>
                  3. <small id='1ojJr'></small><noframes id='1ojJr'>

                      <bdo id='1ojJr'></bdo><ul id='1ojJr'></ul>