【发布时间】:2016-08-11 19:10:45
【问题描述】:
在我的脚本中,我需要使用逗号和点以及最大值和最小值来验证价格。 这是我的规则()
return [
[['price'], 'required', 'message' => 'Price ...'],
[['price'], 'number', 'numberPattern' => '/^[0-9]{1,2}([\.,][0-9]{1,2})*$/',
'message' => 'Price ...', 'max' => 25, min => '0'],
];
当我输入 25.00 (.dot) 之类的价格时效果很好,但是当我输入 25,01 (, 逗号) 时,验证不起作用。你知道如何让它工作吗?
【问题讨论】:
标签: php validation yii2 price