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' => '年龄',
], ];
Laravel 中 validation 验证 返回中文提示 全局设置的更多相关文章
- laravel中的验证及利用uploadify上传图片
$rules = [ 'password'=>'required|between:6,20|confirmed', ]; $message = [ 'password.required'=> ...
- 如何 Laravel 中验证 zip 压缩包里的文件?
在 Laravel 程序中上传文件时,请求验证可以很好验证上传的文件.你可以要求上传文件必须为 图片 , 也可以限制文件字节 大小 , 也可以根据 mime types 或者 文件扩展名 过滤文件. ...
- 在系统中使用Bean Validation验证参数
转自:http://www.importnew.com/18561.html 为什么要使用Bean Validation? 当我们实现某个接口时,都需要对入参数进行校验.例如下面的代码 1 2 3 ...
- laravel中,提交表单后给出提示例如添加成功,添加失败等等
laravel中的表单插入,我想在表单插入成功后,可以像thinkphp一样可以有一个提示内容,上网Google,他们还是给出的方法就是 return redirect('/')->with(' ...
- Laravel表单验证提示设置多语言
默认表单提示是英文的,我们可以安装语言包构建多语言环境. 根据版本选择命令 For Laravel 7.x : run composer require caouecs/laravel-lang:~6 ...
- 社群系统 ThinkSNS+ 中如何利用 Laravel 表单验证来验证用户名的?(我朝独有需求,两个字母占一个汉字。。。)
ThinkSNS+后端框架使用laravel,每周和 laravel master 保持同步,而后台和 html 5 则采用 vue 开发.语言特性方面,采用 php 7 的严格模式. 言归正传,之所 ...
- 关于脱离laravel框架使用Illuminate/Validation验证器
1.关于Illuminate/Validation验证器 Validation 类用于验证数据以及获取错误消息. github地址:github.com/illuminate/validation 文 ...
- ssm中返回中文字符串时出现乱码?
问题:返回json格式时,前端ajax请求,响应数据接收正常: 返回String时,响应数据是乱码? 解决:@RequestMapping注解中添加:produces = "text ...
- Laravel中的信息验证 和 语言包
首先,谈下语言包的问题 1.安装语言包,通过composer进行安装 composer require "overtrue/laravel-lang:dev-master" 2.成 ...
随机推荐
- 考试总结 模拟28(W)
心得: 状态极差,都怪放假,上一套的T3没改完,今天考试没有一点状态,开学恐惧症.(不恐惧作业或一调但还是很茫然) T1能A掉实在是意外,杂题T1没做过,可能是人品守恒,(丢了钱今天才发现以后一定锁柜 ...
- 推荐一个 Laravel admin 后台管理插件
如何优雅的写代码,我想是每位程序员的心声.自从15年初第一次接触 Laravel 4.2 开始,我就迷上使用 Laravel 框架了.我一直都想找个时间好好写写有关 Laravel 的使用文章,由浅入 ...
- java如何访问memcache
1 Memcache是什么 Memcache是danga.com的一个项目,最早是为 LiveJournal 服务的,目前全世界不少人使用这个缓存项目来构建自己大负载的网站,来分担数据库的 ...
- vue 微信内H5调起支付
在微信内H5调起微信支付,主要依赖于一个微信的内置对象WeixinJSBridge,这个对象在其他浏览器中无效. 主要代码: import axios from 'axios'; export def ...
- qt 鼠标拖动窗口放大缩小
// 鼠标拖动 具体实现void mouseMoveEvent(QMouseEvent * pEvent) { if (pEvent->buttons() & Qt::LeftButto ...
- JQuery-- 获取元素的宽高、获取浏览器的宽高和垂直滚动距离
* 能够使用jQuery设置尺寸 * .width() width * .innerWidth() width + padding * .outerWidth() width + padding + ...
- python基础总结篇
''' 数据类型 数值 int: 字符串转int,只能转纯数字组成的字符串 小数,去掉小数部分 bool,true 1 false 0 float: 字符串转float,要么是纯数字的字符串,要么是纯 ...
- SiteMesh:一个优于Apache Tiles的Web页面布局、装饰框架
一.SiteMesh项目简介 OS(OpenSymphony)的SiteMesh是一个用来在JSP中实现页面布局和装饰(layout and decoration)的框架组件,能够帮助网站开发人员较容 ...
- python 子类中定义init方法
- springboot 自定义starter之AutoConfiguration【原】
八.自定义starter AutoConfiguration: 1.这个场景需要使用到的依赖是什么? 没有特别依赖的配置 2.如何编写自动配置 @Configuration //指定这个类是一个配置类 ...