Laravel 中 validation 验证 返回中文提示 全局设置

Laravel 中 validation 验证 返回中文提示 全局设置

<?php

return [

/*
|--------------------------------------------------------------------------
| Validation Language Lines
|--------------------------------------------------------------------------
|
| The following language lines contain the default error messages used by
| the validator class. Some of these rules have multiple versions such
| as the size rules. Feel free to tweak each of these messages here.
|
*/

'accepted'             => ':attribute必须接受',
'active_url'           => ':attribute必须是一个合法的 URL',
'after'                => ':attribute 必须是 :date 之后的一个日期',
'after_or_equal'       => ':attribute 必须是 :date 之后或相同的一个日期',
'alpha'                => ':attribute只能包含字母',
'alpha_dash'           => ':attribute只能包含字母、数字、中划线或下划线',
'alpha_num'            => ':attribute只能包含字母和数字',
'array'                => ':attribute必须是一个数组',
'before'               => ':attribute 必须是 :date 之前的一个日期',
'before_or_equal'      => ':attribute 必须是 :date 之前或相同的一个日期',
'between'              => [
    'numeric' => ':attribute 必须在 :min 到 :max 之间',
    'file'    => ':attribute 必须在 :min 到 :max KB 之间',
    'string'  => ':attribute 必须在 :min 到 :max 个字符之间',
    'array'   => ':attribute 必须在 :min 到 :max 项之间',
],
'boolean'              => ':attribute 字符必须是 true 或 false',
'confirmed'            => ':attribute 二次确认不匹配',
'date'                 => ':attribute 必须是一个合法的日期',
'date_format'          => ':attribute 与给定的格式 :format 不符合',
'different'            => ':attribute 必须不同于 :other',
'digits'               => ':attribute必须是 :digits 位.',
'digits_between'       => ':attribute 必须在 :min 和 :max 位之间',
'dimensions'           => ':attribute具有无效的图片尺寸',
'distinct'             => ':attribute字段具有重复值',
'email'                => ':attribute必须是一个合法的电子邮件地址',
'exists'               => '选定的 :attribute 是无效的.',
'file'                 => ':attribute必须是一个文件',
'filled'               => ':attribute的字段是必填的',
'image'                => ':attribute必须是 jpeg, png, bmp 或者 gif 格式的图片',
'in'                   => '选定的 :attribute 是无效的',
'in_array'             => ':attribute 字段不存在于 :other',
'integer'              => ':attribute 必须是个整数',
'ip'                   => ':attribute必须是一个合法的 IP 地址。',
'json'                 => ':attribute必须是一个合法的 JSON 字符串',
'max'                  => [
    'numeric' => ':attribute 的最大长度为 :max 位',
    'file'    => ':attribute 的最大为 :max',
    'string'  => ':attribute 的最大长度为 :max 字符',
    'array'   => ':attribute 的最大个数为 :max 个.',
],
'mimes'                => ':attribute 的文件类型必须是 :values',
'min'                  => [
    'numeric' => ':attribute 的最小长度为 :min 位',
    'file'    => ':attribute 大小至少为 :min KB',
    'string'  => ':attribute 的最小长度为 :min 字符',
    'array'   => ':attribute 至少有 :min 项',
],
'not_in'               => '选定的 :attribute 是无效的',
'numeric'              => ':attribute 必须是数字',
'present'              => ':attribute 字段必须存在',
'regex'                => ':attribute 格式是无效的',
'required'             => ':attribute 字段是必须的',
'required_if'          => ':attribute 字段是必须的当 :other 是 :value',
'required_unless'      => ':attribute 字段是必须的,除非 :other 是在 :values 中',
'required_with'        => ':attribute 字段是必须的当 :values 是存在的',
'required_with_all'    => ':attribute 字段是必须的当 :values 是存在的',
'required_without'     => ':attribute 字段是必须的当 :values 是不存在的',
'required_without_all' => ':attribute 字段是必须的当 没有一个 :values 是存在的',
'same'                 => ':attribute和:other必须匹配',
'size'                 => [
    'numeric' => ':attribute 必须是 :size 位',
    'file'    => ':attribute 必须是 :size KB',
    'string'  => ':attribute 必须是 :size 个字符',
    'array'   => ':attribute 必须包括 :size 项',
],
'string'               => ':attribute 必须是一个字符串',
'timezone'             => ':attribute 必须是个有效的时区.',
'unique'               => ':attribute 已存在',
'url'                  => ':attribute 无效的格式',

/*
|--------------------------------------------------------------------------
| Custom Validation Language Lines
|--------------------------------------------------------------------------
|
| Here you may specify custom validation messages for attributes using the
| convention "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'         => '年龄',
],

];

 

版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请联系我们举报,一经查实,本站将立刻删除。

发布者:全栈程序员-站长,转载请注明出处:https://javaforall.net/113141.html原文链接:https://javaforall.net

(0)
上一篇 2021年10月23日 下午8:00
下一篇 2021年10月23日 下午9:00


相关推荐

  • 线性代数代码实现(六)矩阵除法(C++)

    线性代数代码实现(六)矩阵除法(C++)前言:距离上一篇文章发布已经五天过去了,在这里先给一直等待的伙伴们说声抱歉,因为博主最近的事情很多,只好暂时停更,望大家理解!上一篇文章中,我们介绍了求解逆矩阵的方法,我提到,可逆矩阵可以定义除法。这一篇文章中,讨论一下怎样实现矩阵除法!一、线性代数知识回顾:事实上,矩阵没有“除法”这一概念,我们的“除法”实际上是用以下方式来定义的:设矩阵,,,其中为可逆矩阵,满足以下等式:变换得:如果我们换一种写法,就成了:这样就定义了矩阵除法,我把它称…

    2022年6月18日
    40
  • Django(9)url指定默认参数[通俗易懂]

    Django(9)url指定默认参数[通俗易懂]前言当我们访问网页的时候,后台返回列表中有n条数据,此时我们会使用分页,比如一页只展示10条,但是我们访问第一页的时候大多数情况下,都会给url一个默认值,访问的时候直接展示第一页数据案例我们的

    2022年7月31日
    11
  • QT5编程入门教程(非常详细)「建议收藏」

    QT5编程入门教程(非常详细)「建议收藏」Qt是一个跨平台的C++框架(C++库),目前最新的版本是Qt5。Qt5还包含了很多小版本,其中推荐Qt5.6或Qt5.9,这两个版本是LTS版本(即长期支持版本),Bug较少,相对稳定。Qt除了支持界面设计(GUI编程),还封装了与网络编程、多线程、数据库连接、视频音频等相关的功能。这套Qt教程以Qt5.9为基础来介绍Qt开发,配有精美的图片以及完整的示例程序,几乎涉及Qt编程的所有模块。注意,本教程不再对C++语法进行介绍,没有C++基础的读者…

    2022年5月16日
    45
  • 智慧小区智能物业管理系统综合解决方案_智能小区管理系统

    智慧小区智能物业管理系统综合解决方案_智能小区管理系统因为传统的办公方式效率低,工作强度大。人们需耗费大量的时间和精力去手工处理那些繁杂、重复的工作,而手工处理的延时和差错,正是现代化管理中应该去除的弊端。又由于物业管理企业的启动基金不足,多种经营服务不善等,导致招不到专业水平高的工作人员,再加上管理手段落后,所以就很难提高物业管理企业的效益。小区管理在手工操作时代,工作非常繁琐,需要大量的人力、物力和财力,极大的浪费了小区物业的资源。而这些项目在过去手工操作时代,需要手工记录这些事情,不但麻烦琐碎,还经常出现错误,给广大业主带来很不便,正是适应这种社…

    2022年10月18日
    5
  • python远程调试_pycharm远程调试linux服务器python项目

    python远程调试_pycharm远程调试linux服务器python项目python 开发的一个重要事项是包管理 想想那么多负责的包 如果没有好的包管理系统 在本机搭建一个包环境是多么复杂 于是放弃了本地构建包的想法 使用远程包 也就是使用项目部署已经搭建完好的生产环境 在本地通过调用远程生产系统进行项目代码调试 pycharm 作为一款强大的 IDE 很好的实现了这个功能 在 pycharm 中 可以使用 ssh 来配置 linux 系统中的环境作为项目环境 也可以同步项目代码 一

    2025年10月9日
    7
  • J2EE架构师之路[转]

    J2EE架构师之路[转]
    不经意的回首,工作进入第五个年头了,发现走过了从Java程序员到J2EE架构师的历程。
    发现电脑上安装了各种各样的J2EE工具:JBuilder,WSAD,Eclipse,Rose,Together,Weblogic,Jtest,Optimizator,Mysql…
    发现电脑上保存了各种各样的OpenSource项目:Tomcat,JBoss,Ant,Hibernate,Spring,ibatis,Struts,Log4j,Lucene,MovableTyp

    2022年6月26日
    29

发表回复

您的邮箱地址不会被公开。 必填项已用 * 标注

关注全栈程序员社区公众号