简体   繁体   English

zend模块上的路由

[英]Routes on zend modules

I want to make a kind of alias for my modules: Is there a way to make 我想为我的模块添加一种别名:有没有一种方法可以使

Or do I have to make a route for every single action I make in this module? 还是我必须为在此模块中执行的每个动作创建路线? If I don't make a route my links will look like: 如果我不做路线,我的链接将如下所示:

http://www.example.com/news/news/show and http://www.example.com/news/news/show . http://www.example.com/news/news/showhttp://www.example.com/news/news/show

Ps i'm using Zend 1.10.6 PS我正在使用Zend 1.10.6

Thanx in advance! Thanx提前!

I guess it will be something like that: 我猜会是这样的:

$route = new Zend_Controller_Router_Route(
'news',
array('module' => 'news', 'controller' => 'news', 'action' => 'index'));
$router->addRoute('news', $route);

where first arg 'news' for Zend_Controller_Router_Route is the url http://www.example.com/news that will route to http://www.example.com/news/news/index 其中对于Zend_Controller_Router_Route的第一个参数“新闻”是url http://www.example.com/news将路由到http://www.example.com/news/news/index

salu2 salu2

In your config file you must enable modules by putting this in your config file 在您的配置文件中,您必须通过将其放入配置文件中来启用模块

resources.modules[] = 

And it should by default route correctly in your application. 默认情况下,它应该在您的应用程序中正确路由。

您将必须为要以非标准方式路由的每个URL定义路由。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM