Php 处理不存在的行为?
在Zend框架中处理不存在的操作的最佳方法是什么 根据控制器的不同,我希望能够以不同的方式处理请求 溴Php 处理不存在的行为?,php,zend-framework,Php,Zend Framework,在Zend框架中处理不存在的操作的最佳方法是什么 根据控制器的不同,我希望能够以不同的方式处理请求 溴 Niklas将此函数添加到控制器类 public function __call($method, $args){ if ('Action' == substr($method, -6) && $method != 'indexAction') { // If the action method was not found, forward to th
Niklas将此函数添加到控制器类
public function __call($method, $args){
if ('Action' == substr($method, -6) && $method != 'indexAction') {
// If the action method was not found, forward to the index action
return $this->_forward('index');
}
// all other methods throw an exception
throw new Exception('Invalid method "' . $method . '" called', 500);
}
在这种情况下,缺少的操作将被转发到索引操作