最近使用Zend Framework遇到的一些问题

  目前遇到的困惑有这样一些:

  • 使用 $front->setParam(’useDefaultControllerAlways’, true) 后,会导致各个controller里面$this->_forward()方法的controller参数失效,从实际应用中,这种逻辑不合理。
  • ErrorController按照官方文档会出现$this->_getRequest()方法不存在的错误。 ErrorController::_getRequest() does not exist and was not trapped in __call()
  • 如果继承Zend_Controller_Action抽象类并实现一个自己的Controller基础类,然后每个controller都去继承或者实现这个基类,目的是可以在基础类里面进行一些各个controller里面都会需要的初始化操作,此时会出现一个问题,在访问各个Controller里面的action时,会先调用controller里面的init()方法,然后再去执行基类里面的__contruct()构造函数,这会导致init()方法里面无法得到该构造函数里面进行的初始化结果,这个问题让我曾经郁闷了很久。

  继续研究中,也希望有朋友分享经验。

Category: PHP / Zend
You can follow any responses to this entry through the RSS 2.0 feed. You can leave a response, or trackback from your own site.
2 Responses
  1. dzq says:

    关于controller错误的问题:

    我的同事在index.php里捕捉到异常,然后定向到一个指定的页面。

  2. bwcui says:

    我的同事在index.php里捕捉到异常,然后定向到一个指定的页面。

    我也是这么想的,可路由只发生一次,如何才能“重定向”(不要使用输出JS脚本再重定向的方法)???

Leave a Reply

Your email address will not be published. Required fields are marked *

*
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.
Anti-spam image