Home >Backend Development >PHP Tutorial >How to display the Chinese name of the field in laravel form error message?

How to display the Chinese name of the field in laravel form error message?

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOriginal
2016-08-04 09:20:321505browse

How to display the Chinese name of the field in laravel form error message?

nickname is so unfriendly
This tutorial teaches you how to write it
How to display the Chinese name of the field in laravel form error message?

Reply content:

How to display the Chinese name of the field in laravel form error message?

nickname is so unfriendly
This tutorial teaches you how to write it
How to display the Chinese name of the field in laravel form error message?

Then write them separately

<code>'start.required'=>'请填写开始时间',
'type.required'=>'请填写数据的分类',</code>

Three methods:
1. Use trans() to write, write the Chinese name of the field to /resources/lang/zh-CN/auth.php, and then use it, refer to Laravel 5.2 documentation - Localization :
2. Add the Chinese name to the data table related fields in the data table migration file: ->comment('Chinese name');, refer to Laravel 5.2 document - Migration (but how to get the value of comment, I I haven’t seen it in the document yet)
3.The last method is to install the laravel-lang expansion package, it comes with Chinese form verification prompts, highly recommended! Remember to change locale to "zh-CN" in config/app.php.
How to display the Chinese name of the field in laravel form error message?

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn