问题标签 [zend-router]

For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.

0 投票
3 回答
21085 浏览

xml - Zend框架中如何获取调度的路由名称?

当前状态:

  • 从 xml 文件加载路由器
  • 路由器中的两个路由名称将指向相同的控制器和动作,例如:www-language-employee 和 www-language-trainer 将指向相同的控制器和动作 --> EmployeeController & listemployeeAction

问题: - 需要知道从请求中分派/正在使用哪个路由名称。

示例:1. http://www.mycompany.com/en/trainers/ 预期返回值:www-language-trainer

0 投票
2 回答
133 浏览

zend-framework - 配置路由有哪些不同的方法?

如果有人更熟悉 Zend Framewor,他们就会知道路由是什么以及它们如何影响整个系统。我的问题是有关配置此路由的方法。我知道两种配置它们的方法,通过Bootstrap.phpapplication.ini

然而,不要隐瞒这样一个事实,我自己几乎是 Zend 框架的学习者,我不知道哪个更好,哪个应该优于另一个。

此外,我不知道,如果只有这些方法可以配置路由器?

那么,请告诉我我们可以通过哪些方式配置路由器以及哪种方法比其他方法更好。

PS:我已经包括了我知道的两种方法作为答案

0 投票
1 回答
176 浏览

zend-framework - Zend 框架不关心指定的自定义路由

我创建了一个路由器并像这样添加到控制器中

首先,这个路由器没有做任何事情,每当我导航到 时 /page/list/general/0/1,它都会采用标准路线,而不是新路线。

0 投票
1 回答
718 浏览

php - Zend Framework中的路由两个模块

我创建了控制器:模块/默认/索引/登录我在主引导程序中添加了路由

当我访问 url/login 时它工作正常

之后我创建了另一个控制器:模块/用户/索引/注册

当我访问 url/user/register 时,它返回错误无效操作

当我访问 url/user/index/register 时,它工作正常。

我必须使用 url/user/register 访问

请推荐任何一个。

0 投票
2 回答
390 浏览

zend-framework - Zend 框架 - 路由:通过参数调用动作

那是我目前的代码(见上文)。我现在如何通过给定的参数(通过 URL)调用操作?url 看起来像这样:domain.com/test/news/现在我想在测试控制器中调用操作 newsAction()。使用上面的代码,我得到了错误:Action "category" does not exist and was not trapped in __call()

0 投票
2 回答
2035 浏览

php - Zend 路由不工作

我正在尝试使用 routes.ini 和 bootstrap 设置我的 zend 路由,但由于某种原因,它无法按预期进行路由。我的 routes.ini 和 bootstrap.php 如下。

路线.ini

引导程序.php

0 投票
1 回答
140 浏览

php - 如何将 Zend_Config 与 RewriteRouter 一起使用?

我有以下网址:“http://localhost/mysite/blog/article/index/id/1”

我想像这样构造我的网址:“http://localhost/mysite/blog/article/1”将默认的“操作”设置为“索引”,将“id”设置为“1”。现在我如何在 config.ini 文件中编写这样的路由?

0 投票
1 回答
1308 浏览

php - Zend Framework route for Sub Folders with Rest

For my current Application Setup i am trying to create a routing for Standard Controllers and Rest Controllers.

This is my Structure.

To call a Controller within the admin Sub Folder:

I want to change this to:

In my current setup:

The issue here really is that some Controllers in the API folder are Rest but not all of them.

/api/acl/role is routing correctly to the indexAction as expected.

/api/acl/role/1 is looking for the action "1" where i would expect it to route to getAction.

How could i integrate the Zend_Route_Rest from the module Bootstrap into these rulesets.

Every help would be much appreciated.

0 投票
0 回答
360 浏览

php - 扩展 Zend 路由器以包含 HTTPS 域

有谁知道我可以如何扩展 Zend_Controller_Router_Route_Interface 或适当的 Route 类以包含到 https 域(https://mydomain.com/controller/action)的路由?提前致谢。

0 投票
1 回答
451 浏览

zend-framework - Zend 路由器行为

我的路由器有点问题。

我有一个自定义路线:

但是当我尝试访问这个 url 时:localhost/forum/topic/16 我得到这个错误:

致命错误:未捕获的异常“Zend_Controller_Router_Exception”,消息“未指定主题”

但我不想为主题设置默认值,因为我还希望路由 /forum/topic 列出所有主题......

其次,我知道如果我添加自定义路由,默认路由会被覆盖,但我也需要一些默认路由。我发现的唯一方法是在 url view helper 的第二个参数中设置'default',就像这样

有没有更优雅的方法,而不是对我想使用默认行为的所有 url 执行此操作?