1、在 config/app.php 文件內修改key為 'locale'=>'zh-CN';
2、在laravel框架根目錄下的resources/lang目錄創建 zh-CN/validation.php文件,在該文件內添加一下驗證提示文本:
1 'accepted' => '參數 :attribute 驗證的字段必須為 yes、 on、 1、或 true.', 2 'active_url' => '參數 :attribute 必須是一個合法的 URL.', 3 'after' => '參數 :attribute 必須是給定日期:date之后的值 .', 4 'after_or_equal' => '參數 :attribute 必須等於給定日期:date或:date之后的值 .', 5 'alpha' => '參數 :attribute 必須完全是中文或字母的字符.', 6 'alpha_dash' => '參數 :attribute 可能具有字母、數字、破折號( - )以及下划線( _ ).', 7 'alpha_num' => '參數 :attribute 必須完全是字母、數字.', 8 'array' => '參數 :attribute 必須是一個 PHP 數組.', 9 'before' => '參數 :attribute 必須是給定日期:date之前的值.', 10 'before_or_equal' => '參數 :attribute 必須等於給定日期:date或:date之后的值.', 11 'between' => [ 12 'numeric' => ':attribute 必須在 :min 到 :max 之間', 13 'file' => ':attribute 必須在 :min 到 :max KB之間', 14 'string' => ':attribute 必須在 :min 到 :max 個字符之間', 15 'array' => ':attribute 必須在 :min 到 :max 項之間', 16 ], 17 'boolean' => '參數 :attribute 必須能夠被轉換為布爾值(true 或者 false).', 18 'confirmed' => '參數 :attribute 二次確認不匹配.', 19 'date' => '參數 :attribute 必須是通過 PHP 函數 strtotime 校驗的有效日期,格式為:xxxx-xx-xx aa:bb:cc.', 20 'date_format' => '參數 :attribute 與給定的格式 :format不匹配.', 21 'different' => '參數 :attribute 必須不同於:other.', 22 'digits' => '參數 :attribute 必須是數字 :digits.', 23 'digits_between' => '參數 :attribute 數字長度必須在 :min 和 :max 之間.', 24 'dimensions' => '參數 :attribute必須是圖片並且圖片比例必須符合規則.', 25 'distinct' => '參數 :attribute 指定的字段不能有任何重復值.', 26 'email' => '參數 :attribute 必須符合 e-mail 地址格式.', 27 'exists' => '選定的 :attribute 是無效的.', 28 'file' => '參數 :attribute 必須是成功上傳的文件.', 29 'filled' => '參數 :attribute 在存在時不能為空.', 30 'gt' => [ 31 'numeric' => 'The :attribute 必須大於 :value.', 32 'file' => 'The :attribute 必須大於 :value KB.', 33 'string' => 'The :attribute 必須大於 :value 個字符.', 34 'array' => 'The :attribute 必須大於 :value 項.', 35 ], 36 'gte' => [ 37 'numeric' => '參數 :attribute 必須大於或等於 :value.', 38 'file' => '參數 :attribute 必須大於或等於 :value KB.', 39 'string' => '參數 :attribute 必須大於或等於 :value 個字符.', 40 'array' => '參數 :attribute 必須大於或等於 :value 項.', 41 ], 42 'image' => '參數 :attribute 必須是一個圖像( jpeg、png、bmp、gif、或 svg .', 43 'in' => '參數 :attribute 必須包含在給定的值列表【:values】中.', 44 'in_array' => '參數 :attribute 必須存在於 :other值中.', 45 'integer' => '參數 :attribute 必須是整數.', 46 'ip' => '參數 :attribute 必須是 IP 地址.', 47 'ipv4' => '參數 :attribute 必須是 IPv4 地址.', 48 'ipv6' => '參數 :attribute 必須是 IPv6 地址.', 49 'json' => '參數 :attribute 必須是有效的 JSON 字符串.', 50 'lt' => [ 51 'numeric' => 'The :attribute 必須小於 :value.', 52 'file' => 'The :attribute 必須小於 :value KB.', 53 'string' => 'The :attribute 必須小於 :value 字符.', 54 'array' => 'The :attribute 必須小於 :value 項.', 55 ], 56 'lte' => [ 57 'numeric' => 'The :attribute 必須小於或等於 :value.', 58 'file' => 'The :attribute 必須小於或等於 :value KB.', 59 'string' => 'The :attribute 必須小於或等於 :value 字符.', 60 'array' => 'The :attribute 必須小於或等於 :value 項.', 61 ], 62 'max' => [ 63 'numeric' => ':attribute 的最大長度為 :max 位', 64 'file' => ':attribute 的最大為 :max', 65 'string' => ':attribute 的最大長度為 :max 字符', 66 'array' => ':attribute 的最大個數為 :max 個', 67 ], 68 'mimes' => '參數 :attribute 的文件類型必須是:values.', 69 'mimetypes' => '參數 :attribute 的文件類型必須是:values.', 70 'min' => [ 71 'numeric' => ':attribute 的最小長度為 :min 位', 72 'file' => ':attribute 大小至少為:min KB', 73 'string' => ':attribute 的最小長度為 :min 字符', 74 'array' => ':attribute 至少有 :min 項', 75 ], 76 'not_in' => '參數 :attribute 不能包含在給定的值列表【:values】中.', 77 'not_regex' => '參數 :attribute format is invalid.', 78 'numeric' => '參數 :attribute 必須是數字.', 79 'present' => '驗證的字段:attribute必須存在於輸入數據中,但可以為空.', 80 'regex' => '驗證的字段 :attribute 必須與給定的正則表達式匹配.', 81 'required' => '參數 :attribute 必須存在於輸入數據中,而不是空.', 82 'required_if' => '當指定的字段:other 等於任何一個 value 時,被驗證的字段:attribute必須存在且不為空.', 83 'required_unless' => '當指定的字段:other等於任何一個 :values 時,被驗證的字段:attribute 不必存在.', 84 'required_with' => '只要在指定的其他字段中:values有任意一個字段存在時,被驗證的字段:attribute就必須存在並且不能為空.', 85 'required_with_all' => '只有當所有的其他指定字段:values全部存在時,被驗證的字段:attribute才必須存在並且不能為空.', 86 'required_without' => '只要在其他指定的字段中:values有任意一個字段不存在,被驗證的字段:attribute就必須存在且不為空.', 87 'required_without_all' => '只有當所有的其他指定的字段:values都不存在時,被驗證的參數 :attribute 才必須存在且不為空.', 88 'same' => '參數 :attribute 和 :other 必須匹配.', 89 'size' => [ 90 'numeric' => '參數 :attribute 必須是 :size 位.', 91 'file' => '參數 :attribute 必須是 :size KB.', 92 'string' => '參數 :attribute 必須是 :size 個字符.', 93 'array' => '參數 :attribute 必須包括 :size 項.', 94 ], 95 'string' => '參數 :attribute 必須是字符串.', 96 'timezone' => '參數 :attribute 必須個有效的時區.', 97 'unique' => '參數 :attribute 已存在.', 98 'uploaded' => '參數 :attribute 上傳失敗.', 99 'url' => '參數 :attribute 必須是有效的 URL.', 100 'mb_max' => '參數 :attribute 必須是 :mb_max 字符以內.', 101 'phone' => '參數 :attribute 手機號碼不合法',