比如:
rules里定义了 array(‘username’ , ‘required’);
当username为空,会返回username cannot be blank.
希望返回 username不能为空.
因为提示默认的英文用户体验不太好…请高手帮忙.谢谢!
比如:
rules里定义了 array(‘username’ , ‘required’);
当username为空,会返回username cannot be blank.
希望返回 username不能为空.
因为提示默认的英文用户体验不太好…请高手帮忙.谢谢!
最简单的方法,在main.php设置语言为中文就行了。
return array(
'basePath'=>dirname(__FILE__).DIRECTORY_SEPARATOR.'..',
'name'=>'website name',
'language'=>'zh_cn',
//....other code
读一下这两篇文章:
http://www.yiiframework.com/wiki/1/how-to-customize-the-error-message-of-a-validation-rule
http://www.yiiframework.com/wiki/18/how-to-customize-yii-core-messages
明白了,非常感谢!