假设我有这个:
$validator->add('title', [
'lengthBetween' => [
'message' => 'Must be between %d and %d chars',
'rule' => ['lengthBetween', 3, 100]
]
])
我想知道:
$validationDomain
模型属性); %s/%d
或{0}
)。谢谢。
答案 0 :(得分:2)
占位符已在3.x中删除。这背后的原因是现在更容易翻译消息以进行验证,因为它们现在存在于方法而不是类属性中。
所以实际的做法是:
$validator->add('title', [
'lengthBetween' => [
'message' => __('Must be between {0} and {1} chars', 3, 100),
'rule' => ['lengthBetween', 3, 100]
]
])