Laravel 附带此验证消息,以千字节为单位显示文件大小:
file' => 'The :attribute may not be greater than :max kilobytes.',
我想以显示兆字节而不是千字节的方式对其进行自定义。
所以对于用户来说,它看起来像:
"The document may not be greater than 10 megabytes."
我怎样才能做到这一点?
最佳答案
我们可能在不同的页面上,这就是我想说的。我希望这有帮助。干杯!
public function rules()
{
return [
'file' => 'max:10240',
];
}
public function messages()
{
return [
'file.max' => 'The document may not be greater than 10 megabytes'
];
}
关于laravel - 如何更改最大文件大小的 Laravel 验证消息(以 MB 而不是 KB 为单位)?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34414278/