douci1196 2010-09-30 15:10
浏览 83
已采纳

Zend的不区分大小写的URL路由

I am working with legacy code written in PHP 5.2.6 with Zend Framework 1.5.3 on CentOS 5.5

There is code as such

url:"./sales/getAlerts/?bypass=1"

The view is named getalerts.phtml

Controller function is named getAlertsAction

Code works fine on existing server, but when I try moving it to a new server the code fails stating that ...'Action "getalerts" does not exist...

If I change the lines mentioned above to make the [A] in Alerts lower case the code works.

I've copied over php.ini, httpd.conf, and .htaccess. Not sure what else could allow case insensitive mapping to occur.

What is it that allows url-routing to be case insensitive?

  • 写回答

3条回答 默认 最新

  • dongluo1853 2010-09-30 15:46
    关注

    You should be able to use any URLs you want in your routes... I'm guessing you are using the default /:controller/:action/* route? If so, create custom ones to point to the lower-case actions that you've defined.

    The confusion lies in mapping your route parameters to your actual controllers/actions/modules. Each 'word' is broken down into camelCase for the controller action, but everywhere else you have to use the hyphen to separate words.

    test = testAction = test.phtml test-something = testSomethingAction = test-something.phtml

    You should be able to modify this behaviour. Check out Zend_Controller_Dispatch_Abstract::formatActionName(). However, ideally, you'd just want to modify your route.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(2条)

报告相同问题?

悬赏问题

  • ¥15 如何在scanpy上做差异基因和通路富集?
  • ¥20 关于#硬件工程#的问题,请各位专家解答!
  • ¥15 关于#matlab#的问题:期望的系统闭环传递函数为G(s)=wn^2/s^2+2¢wn+wn^2阻尼系数¢=0.707,使系统具有较小的超调量
  • ¥15 FLUENT如何实现在堆积颗粒的上表面加载高斯热源
  • ¥30 截图中的mathematics程序转换成matlab
  • ¥15 动力学代码报错,维度不匹配
  • ¥15 Power query添加列问题
  • ¥50 Kubernetes&Fission&Eleasticsearch
  • ¥15 報錯:Person is not mapped,如何解決?
  • ¥15 c++头文件不能识别CDialog