Codeigniter表单验证允许数字类型包含逗号

Codeigniter表单验证允许数字类型包含逗号,codeigniter,validation,Codeigniter,Validation,使用CI验证价格时,我使用以下规则 $this->form_validation->set_rules('price','lang:price','required|numeric|greater_than[0.99]'); 有没有办法允许在这个规则行中使用逗号?或者我必须创建回调吗?从使用表单验证库开始,我从未见过任何不需要回调就可以创建回调的东西 但这将是回调: function numeric_wcomma ($str) { return preg_match('/^

使用CI验证价格时,我使用以下规则

$this->form_validation->set_rules('price','lang:price','required|numeric|greater_than[0.99]');

有没有办法允许在这个规则行中使用逗号?或者我必须创建回调吗?

从使用表单验证库开始,我从未见过任何不需要回调就可以创建回调的东西

但这将是回调:

function numeric_wcomma ($str)
{
    return preg_match('/^[0-9,]+$/', $str);
}
有条不紊

$this->form_validation->set_rules('input', 'Input', 'callback_numeric_wcomma');

Codeigniter 3提供正则表达式验证

使用Ben给出的正则表达式。。。不需要回调

$this->form_validation->set_rules('price','lang:price','required|numeric|greater_than[0.99]|regex_match[/^[0-9,]+$/]');

谢谢,我希望有一种方法可以在单行线上完成,但我会接受回电。我相信这应该是正确的答案,因为这是OP试图实现的单行线。