Php 从zend framework应用程序中的indexController中删除索引
我想从索引控制器生成的每个操作中删除url中的索引词 domain.com/index/user/id/1Php 从zend framework应用程序中的indexController中删除索引,php,mysql,.htaccess,zend-framework,Php,Mysql,.htaccess,Zend Framework,我想从索引控制器生成的每个操作中删除url中的索引词 domain.com/index/user/id/1 它应该是domain.com/user/id/1 和 domain.com/index/home 应该是domain.com/home 我该怎么做?如果您有解决方案,请告诉我。 我使用的是zf1.12,您可以在Bootstrap.php(although in application.ini)中完成。将此添加到引导: Bootstrap.php(未经测试) Application.ini(
它应该是domain.com/user/id/1
和
domain.com/index/home
应该是domain.com/home 我该怎么做?如果您有解决方案,请告诉我。
我使用的是zf1.12,您可以在Bootstrap.php(although in application.ini)中完成。将此添加到引导: Bootstrap.php(未经测试) Application.ini(未经测试)
这对我来说很好,但为什么这行Zend_Controller_Front::getInstance()。我们可以不创建实例就这样做吗?嗯,不知道,从未尝试过。只需使用applications.ini;)$router->addRoute(在zend framework中如何工作?请查看文档或本教程:
/**
* Setup Routig.
* Now all calls are send to indexController like
* URL/ACTION-1
* URL/ACTION-2
*
* @return void
**/
protected function _initRouters()
{
$router = Zend_Controller_Front::getInstance()->getRouter();
$route = new Zend_Controller_Router_Route(
':action/*',
array(
'controller' => 'index',
'action' => 'index'
)
);
$router->addRoute('default', $route);
}
routes.index.type = "Zend_Controller_Router_Route"
routes.index.route = "/"
routes.index.defaults.module = "default"
routes.index.defaults.controller = "index"
routes.index.defaults.action = "index"