表单验证问题 [ 新手入门 ]
<?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.
报这个错误
共 9 条回复
-
windygoose 回复于 2012-07-31 18:14 举报
你把model的属性注释掉了肯定报这个错啊
//private $departuredate=null;
mab741
注册时间:2012-07-30
最后登录:1970-01-01
在线时长:0小时0分
最后登录:1970-01-01
在线时长:0小时0分
- 粉丝0
- 金钱145
- 威望0
- 积分145