被childrenController继承
class CommController{
public function add(){
if(IS_POST){
$this->save();
}
else{
//不是官方手册里的_before_add
if(method_exists($this,'befor_add')){
$this->befor_add($data);
}
$this->display();
}
}
}
childrenController extends CommController{
function before_add(){
echo '我存在!';
}
}
现访问childrenController的add方法,没有输出,求解。如果去掉这句if(method_exists($this,'befor_add'))会直接报错,不存在before_add方法。
最佳答案
