yii\base\model:geterrors 怎么使用
1个回答
展开全部
getErrors()
public method
Returns the errors for all attribute or a single attribute.
See also:
getFirstErrors()
getFirstError()
array getErrors( $attribute = null )
$attribute
string
Attribute name. Use null to retrieve errors for all attributes.
return
array
Errors for all attributes or the specified attribute. Empty array is returned if no error.
Note that when returning errors for all attributes, the result is a two-dimensional array, like the following:
[
'username' => [
'Username is required.',
'Username must contain only word characters.',
],
'email' => [
'Email address is invalid.',
]
]
public method
Returns the errors for all attribute or a single attribute.
See also:
getFirstErrors()
getFirstError()
array getErrors( $attribute = null )
$attribute
string
Attribute name. Use null to retrieve errors for all attributes.
return
array
Errors for all attributes or the specified attribute. Empty array is returned if no error.
Note that when returning errors for all attributes, the result is a two-dimensional array, like the following:
[
'username' => [
'Username is required.',
'Username must contain only word characters.',
],
'email' => [
'Email address is invalid.',
]
]
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询