2007
06.21

  之前提到Zend Framework的三个问题,有两个问题今天晚上搞明白了。

  • ErrorController官方文档里面提到的_getRequest(‘error_handler’)方法不存在的问题,改成 $this->_getParam(‘error_handler’)即可解决。
  • Controller里面的init()方法会在基类的构造函数__construct()之前调用的问题,通过阅读 Zend_Controller_Action类里面的100-130行找到解决办法,就是在基类的__construct()里面,把 parent::__construct($request, $response, $invokeArgs); 移到初始化操作之后,比如__construct()的最后一行即可解决。

  第三个关于 useDefaultControllerAlways 参数导致_forward()方法的controller参数失效的问题不是太紧急,回头再研究。

  顺便提一下,ZF的Router功能实在太强大了,甚至支持正则匹配,完全可以写出任何你想要的灵活的URL来,赞!

No Comment.

Add Your Comment

*
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