1
我想在$this->form_validation->set_rules()
添加正則表達式,但無法找到任何正確的解決方案。 因爲我想,我的輸入字段應該只有0或1憑什麼我把裏面setrules()
像如何使用正則表達式與form_validation庫
$this->form_validation->set_rules('binary', 'Binary', 'required|regexp_match[*//code..]');
在此先感謝
感謝@jari的幫助,但我認爲expession應該是這樣.. ... $ this-> form_validation-> set_rules('binary','Binary','required | regex_match [^ [01] {1} $ ^]')否則顯示錯誤「preg_match()[function.preg-匹配]:無結尾分隔符'^'找到「 – arglee
哦,我錯過了分隔符。嘗試更新版本。 – vikingmaster