2008
04.26

今天把Zend Framework升级到了1.5.1最新版,发现有些连接访问出错,查官方文档发现是因为Action里面的“驼峰命名”方式的改变导致。

原来的情况是这样:假如我们有个 aaaBbbController::cccDddAction这么一个东西,访问的url可以是 /aaabbb/cccddd/ 也可以是 /aaaBbb/cccDdd/
现在的情况是这样:要么把方法写成 aaabbbController::cccdddAction 统一的小写,要么url里面改成这样 /aaa.bbb/ccc.ddd/ 或者 /aaa-bbb/ccc-ddd/

我还没有来得及搞明白这样改进的好处是什么。

官方文档:
7.13.1. Migrating from 1.0.x to 1.5.0 or newer
CamelCasedNamingConventions

5 comments so far

Add Your Comment
  1. 黔驴 on April 26, 2008 at 6:37 pm  

    (Quote)
    said:

    官方提供了一个解决办法是:
    $frontController->setParam(‘useC…

    文档提供了三种方法,您说的那种方法被列为最佳、折中之后的第三种解决办法,还是不建议采用。

  2. niule on July 22, 2008 at 7:21 pm  

    (Quote)
    said:

    实在不知道哪里给你留言了呵呵

    请教个问题

    我现在用zf做项目,关于静态页面,你是怎么处理…

    如果你要用纯粹的controller,可以配置服务器的rewrite规则,对于明确的.html等静态页面的url访问可以不进行rewrite到index.php,或者对于某些存放静态页面的特定目录不rewrite,这是唯一的办法。

    另外,如果使用zf不使用它的controller机制,那就可以只把他当作类似pear的模块来使用,这样就不用都走index.php了。

*
To prove you're a person (not a spam script), type the security word shown in the picture. Click on the picture to hear an audio file of the word.
Click to hear an audio file of the anti-spam word