Yii

yii FROM_UNIXTIME CDbCriteria

在 YII CDbCriteria 使用 FROM_UNIXTIME 函数:
$today = date('Y-m-d',time());
$format = '%Y-%m-%d';
$Criteria = new CDbCriteria();
$Criteria->condition = "(FROM_UNIXTIME(`addtime`, :format) = :date)";
$Criteria->params = array(':format'=>$format, ':date'=>$today);

$Criteria->order = '`addtime` DESC';
$Criteria->limit = 26;
$data = News::model()->findAll($Criteria);
var_dump($data);

0 个评论

要回复文章请先登录注册