mab741 2012-07-31 17:18:41 3039次浏览 9条回复 0 0 0
<?php
class Airport extends CActiveRecord
{

	private $_tableName;
	private $departurecity = NULL;
	//private $arrivalcity =null;
	//private $departuredate=null;
	
	public static function model($className=__CLASS__)
	{
		return parent::model($className);
	}


	public function tableName()
	{
      		$this->_tableName = 'fligh';

		return $this->_tableName;
	}
	
	
	
	public function rules()
	{
		// NOTE: you should only define rules for those attributes that
		// will receive user inputs.
		return array(
			array('departurecity','required','message'=>'出发城市不能为空'),
			array('arrivalcity','required','message'=>'出发城市不能为空'),
			array('departuredate','required','message'=>'出发城市不能为空'),
		);
	}

}

model层

	$model = new Airport();
              $model->attributes=$_POST;
          
          	if($model->validate()){

}

controllers层,

Property "Airport.departurecity" is not defined. 报这个错误

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