pinsn 2012-07-27 16:07:17 2851次浏览 2条回复 0 0 0
public function actionProcessAdmin()
{
	$model = new A();
	$model->unsetAttributes(); // clear any default values		
	$criteria = new CDbCriteria;
	$criteria->addInCondition('status', array(2,3,4));		
	$data = new CActiveDataProvider($model, array(
			'criteria'=>$criteria,
	));	
	$this->render('admin',array(
            'model'=>$model,
	));
}

为什么addInCondition 条件没有执行啊?

  • 回复于 2012-07-27 16:40 举报

    $data没有返回东西?确定sql语句没错吗?

  • 回复于 2012-07-29 10:53 举报
    $data = new CActiveDataProvider($model, array(
        'criteria'=>$criteria,
    ));
    

    改成

    $data = new CActiveDataProvider(‘A’, array(
        'criteria'=>$criteria,
    ));
    

    试试。

您需要登录后才可以回复。登录 | 立即注册