[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  阅读(664)  评论(0编辑  收藏  举报