-
zend_framework 处理不存在的 controller
日期:2008-11-05 | 分类:班门弄斧
我的第一个项目准备完成了,使用了 zend_framework 框架,MVC 的好处不说了,看了 N 次 zend_framework 手册,都没有搞清楚 zend_framework 怎么处理不存在的页面的(不过中英版本一起看才知道英文版比较好理解些)。
最后在 atoat 的空间里找到了答案,在此记下,也谢谢 atoat 的贡献。
zf 处理不存在的 controller 使用的是默认 errorController.php 的 errorAction 来实现。
errorController.php :
<?php
class ErrorController extrends Zend_Controller_Action
{
public function errorAction()
{
// 有个前提:在index.php 里要设置 $frontController -> throwExceptions(false);
// 注意 这里是errorAction ,默认的是 error.phtml
}zf 处理不存在的 Action 就比较容易找了,在手册里也找得到。即在每个 controller 里定义一个 public function __call() 就可以了。
共1页 1









