class CFileCache extends CActiveRecordbehavior
{
public function events(){
return parent::events();
}
public function afterFind($event)
{
echo '<div style="color:#FA0;">当在删除后,我被执行了!</div>';
}
}
同时在模型中,做了行为绑定
//行为绑定
public function behaviors()
{
return array('CFileCache'=>'application.behaviors.CFileCache');
}
class CFileCache extends CActiveRecordbehavior
{
public function events(){
return parent::events();
}
public function afterFind($event)
{
echo '<div style="color:#FA0;">当在删除后,我被执行了!</div>';
}
}
同时在模型中,做了行为绑定
//行为绑定
public function behaviors()
{
return array('CFileCache'=>'application.behaviors.CFileCache');
}
为什么我在做数据库查询的时候没有任何输出呢?
应该是这样定义 behaviors:
public function behaviors(){
return array(
'CFileCache' => array(
'class' => 'CFileCache',
)
);
}