naigo 2011-07-06 14:32:12 4419次浏览 2条回复 0 0 0

模型Provider.php里:

public function rules()
{
  return array(
    array('name, email', 'unique'),
    array('email', 'email'),			
    array('name, email, company_name, homepage, description', 'required'),
    array('suite', 'numerical', 'integerOnly'=>true),
    array('name, company_name, report_file_root', 'length', 'max'=>256),
    array('password, password_repeat, homepage, address', 'length', 'max'=>128),
    array('email', 'length', 'max'=>64),
    array('phone, province, country', 'length', 'max'=>32),
    array('city, zip_code', 'length', 'max'=>16),
    array('company_introduction', 'safe'),
    array('name, company_name,company_size, homepage, email, phone, address, city, zip_code, province, country', 'safe', 'on'=>'search'),
    array('verifyCode', 'captcha', 'allowEmpty'=>!extension_loaded('gd'), 'on'=>'create'),
    array('password', 'compare', 'compareAttribute'=>'password_repeat', 'on'=>'create'),
    array('name, email, password, homepage', 'required' , 'on'=>'create'),
  );
}

ProviderController.php里一个方法中$model=new Provider('create'); $model->validate()总是无返回值,创建实例的时候加了create参数因改是按照有'on'=>'create'的那三行过滤吧?问么会一直无返回值呢,print($model->validate());什么都没有输出。

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