1.覆盖提示信息:
打开resource/lang/en/validation.php注释掉英文提示信息
将下面的提示信息覆盖英文提示信息
<"attribute.rule" to name the lines. This makes it quick to | specify a specific custom language line for a given attribute rule. | */ 'custom' => [ 'attribute-name' => [ 'rule-name' => 'custom-message', ], ], /* |-------------------------------------------------------------------------- | Custom Validation Attributes |-------------------------------------------------------------------------- | | The following language lines are used to swap attribute place-holders | with something more reader friendly such as E-Mail Address instead | of "email". This simply helps us make messages a little cleaner. | */ 'attributes' => [ // 'name' => '名字', // 'age' => '年龄', ], ];
2.安装中文信息提示包
composer require "overtrue/laravel-lang:~3.0"
注册服务提供者: config/app.php
'providers' => [ // Illuminate\Translation\TranslationServiceProvider::class, Overtrue\LaravelLang\TranslationServiceProvider::class, ]
修改语言:config/app.php
'locale' => 'zh-CN',
以上这篇Laravel修改验证提示信息为中文的示例就是小编分享给大家的全部内容了,希望能给大家一个参考,也希望大家多多支持。
免责声明:本站文章均来自网站采集或用户投稿,网站不提供任何软件下载或自行开发的软件!
如有用户或公司发现本站内容信息存在侵权行为,请邮件告知! 858582#qq.com
桃源资源网 Design By www.nqtax.com
暂无“Laravel修改验证提示信息为中文的示例”评论...