刚开始接触yii时没弄明白这两个方法是如何工作的,今天遇到一个问题,需要使用,又仔细看了一下。简单记录一下用法。
<pre class="lang:php decode:true " > public function beforeFind(){ parent::beforeFind(); $this->dbCriteria->condition='field=1'; } </pre>
<pre class="lang:php decode:true " > public function afterFind(){ parent::afterFind(); $this->title="<h1>{$this->title}</h1>"; }</pre>