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)
全栈程序员-站长的头像全栈程序员-站长


相关推荐

  • 如何反编译小程序的源码(微信小程序反编译工具)

    网易Mumu模拟器安装下载地址:http://mumu.163.com/360/ 下载完安装包后直接安装 打开模拟器安装微信、RE文件管理器设置Root权限打开RE文件管理器,提示请求超级用户访问权限,选择允许到此准备工作完成。打开微信,然后打开小程序,获取小程序编译包先打开微信 搜索微博小程序打开 打开RE文件管理 按照/data/data/com.tencent.mm/MicroMsg/80b34bca4945f…

    2022年4月18日
    53
  • STUN协议详解

    STUN协议详解   基于RFC3489标准的stun协议,无法穿越TCP类型NAT,只是适用于在现有NAT类型下的UDP穿越,另一种特殊情况NAT也无法进行穿越,就是对称型NAT,在很多企业中就很多属于对称型NAT,后面会讲到。STUN的发现过程是基于UDP的NAT处理的假设;随着新的NAT设备的部署,这些假设可能会被证明是无效的,当STUN被用来获取一个地址来与位于其在同一NAT后面的对等体通信时,它就不起作用了。当stun服务器的部署不在公共共享地址域范围内时,stun就不起作用。1.定义STUN客户端:产生

    2022年7月17日
    20
  • jquery 中append追加不能写if等逻辑语句及table列合并问题

    jquery 中append追加不能写if等逻辑语句及table列合并问题

    2021年7月15日
    100
  • WebSocket 详解教程

    WebSocket 详解教程概述WebSocket是什么?WebSocket是一种网络通信协议。RFC6455定义了它的通信标准。WebSocket是HTML5开始提供的一种在单个TCP连接上进行全双工通讯

    2022年7月4日
    20
  • 齐次坐标讲解_齐次方程为什么叫齐次

    齐次坐标讲解_齐次方程为什么叫齐次齐次坐标的表示根据《向量几何在游戏编程中的使用6》中关于基的概念。对于一个向量v以及基oabc,可以找到一组坐标(v1,v2,v3),使得v=v1a+v2b+v3c(1)而对于一个点p,则可以找到一组坐标(p1,p2,p3),使得p–o=p1a+p2b+p3c(2)从上面对向量和点的表达,我们可以看出为了在坐标系中表示一个点(如p),我们把点的位置看作是对这个基的原点o所进行的一个位移,即一个向量——p–o(有的书中把这样的向.

    2025年6月21日
    0
  • Landsat8 OLI数据不同波段组合作用

    Landsat8 OLI数据不同波段组合作用OLI波段合成 R、G、B 主要用途 4、3、2 自然真彩色 7、6、4 城市 5、4、3 标准假彩色图像、植被 6、5、2 农业 7、6、5 穿透大气层 5、6、2 健康植被 5、6、4

    2022年7月23日
    21

发表回复

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

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