[Yii Framework] CdbExpression的用处

例如,要存储timestamp的值是用MySQL now()函数,这时候可以这样,

 

$post = new Post;
$post->createTime=new CdbExpression('NOW()');
//$post->createTime='NOW()';will not work because 'NOW()' will be treated as a string
$post->save();

posted @ 2010-04-21 11:49 DavidHHuan 阅读(...) 评论(...) 编辑 收藏