我想使用 form_validation 类验证输入,这将允许我在字段中输入数字或空值。
像这样:
$this->form_validation->set_rules('field[]','The field','numeric or empty|xss_clean');
这有可能实现吗?
最佳答案
$this->form_validation->set_rules('field[]', 'The field', 'numeric|xss_clean');
理论上这应该足够了,因为该字段尚未设置为必填。
https://stackoverflow.com/questions/8371129/