Php ZF路由问题

Php ZF路由问题,php,zend-framework,Php,Zend Framework,我刚开始使用zend framework 1.9.1进行冒险,但遇到的问题很少。我想删除默认路由,以避免在不同的URL上显示相同的内容-为了实现这一点,我在bootstraper中编写了自定义函数 <?php class Bootstrap extends Zend_Application_Bootstrap_Bootstrap { protected function _initMyRouter() { $this->bootstrap('rout

我刚开始使用zend framework 1.9.1进行冒险,但遇到的问题很少。我想删除默认路由,以避免在不同的URL上显示相同的内容-为了实现这一点,我在bootstraper中编写了自定义函数

<?php

class Bootstrap extends Zend_Application_Bootstrap_Bootstrap
{
    protected function _initMyRouter()
    {
        $this->bootstrap('router')
             ->getContainer()
             ->frontcontroller
             ->getRouter()
             ->removeDefaultRoutes();
    }
}
在ErrorController中解决这个问题,但我的问题是。。。我做错什么了吗

第二个问题是,我只需要生成绝对URL,所以我在application.ini中添加了resources.frontController.baseurl=“”,但在这之后,每个URL都指向默认控制器。如何修复它


第三个(也是最后一个)是。。。如何在我的操作中调用Zend_Controller_Action_Helper_Url::Url?我尝试了类似$this->\u helper->url(array(),'frontpage')的方法,但它调用了Zend\u Controller\u Action\u helper\u url::direct

我会先回答第三个问题,因为我可以直接告诉你

我通常使用
$this->view->url(数组(…),'routeName',true)最后一个参数重置参数。我发现视图辅助对象比动作辅助对象更容易/更快地键入。尽管我认为
$this->\u helper->url->url(…)
是访问操作助手的正确方法

我从未删除过默认路线-但是如果今天晚些时候没有其他答案-我会在下班后为您做一些测试

public function throwAction()
{
    throw new Zend_Controller_Dispatcher_Exception;
}