简体   繁体   English

表单验证代码点火器大于0

[英]form validation codeigniter greater than 0

I have this code: $this->form_validation->set_rules('pay', '', 'required', array("required" => "this field is required")); 我有以下代码: $this->form_validation->set_rules('pay', '', 'required', array("required" => "this field is required"));

I neet to change to validate greater than 0. 我无需更改以验证大于0。

Like this: 像这样:

$this->form_validation->set_rules('pay', '', 'greater_than', array("greater_than" => "only values greater than 0"));

How can I do that? 我怎样才能做到这一点?

您只需要添加如下规则

$this->form_validation->set_rules('pay', '', 'required| greater_than[0]');

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM