sxtuwy
if($model->save()){ Yii::app()->user->setFlash('updated','修改成功!'); $this->refresh();//当用户刷新时去掉提示,而不是重复提交。 }
原来是$this->refresh搞的鬼,因为没有加大括号,导致一起刷新,唉.....辛苦各位了。
public function rules() { // NOTE: you should only define rules for those attributes that // will receive user inputs. return array( array('username, fullname, sex, classroom_id, grade_id', 'required'), array('password,confirmPassword', 'required','on'=>'create'), array('username','unique','on'=>'create,update'),//,'className'=>'User' array('password', 'compare', 'compareAttribute'=>'confirmPassword','on'=>'create,update'), //array('confirmPassword', 'compare', 'compareAttribute'=>'password','on'=>'update'), array('sex', 'numerical', 'integerOnly'=>true), array('username, password, fullname', 'length', 'max'=>16,'on'=>'create'), array('classroom_id, grade_id', 'length', 'max'=>8), array('photo','file','types'=>'jpg,gif,png','maxSize'=>'524288','allowEmpty'=>false,'on'=>'create'), array('verifyCode', 'captcha', 'allowEmpty'=>!CCaptcha::checkRequirements()), array('remark', 'safe'), array('fullname', 'match','pattern'=>"/^[\x7f-\xff]+$/",'message'=>"姓名只能是中文!"),//这行也能用。还有说是080 array('username,password', 'match','pattern'=>"/^[".chr(0xa1)."-".chr(0xff)."A-Za-z0-9_]+$/",'message'=>"只允许字母、数字、下划线!"), // The following rule is used by search(). // Please remove those attributes that should not be searched. array('id, username, password, fullname, sex, classroom_id, grade_id', 'safe', 'on'=>'search'), //array('password,confirmPassword','alter_pwd','on'=>'update'), ); }
- sxtuwy 发布了话题在带有文件上传的表单的验证问题?
- sxtuwy 发布了话题前后台两个一样的模型,到底该用哪个?
- sxtuwy 回复了话题 php数组如何每循环一次加一次深度?
哥们儿,你这个必须是几层,我这个不能给定几层。谢谢你的回答。
- sxtuwy 回复了话题 php数组如何每循环一次加一次深度?
哥们儿,我知道使用递归和非递归算法,关键这两种,我搞不出来具体算法来。
- sxtuwy 发布了话题php数组如何每循环一次加一次深度?
哥们儿,我知道官方的那几个用法和例子,我要的树形结构的数组。这个官方没有提供。树的遍历算法,我几乎只是考试及格。我在考软件工程师的时候就没有通过。如何能输出树形结构的数组,版主再给点建议吧。