dongmen9517 2015-05-30 07:33
浏览 48

我想在PHP验证中只允许2个字母之间的1个逗号

Hello I have a scenario that, in textbox I can enter string like

"1,2,3" this would be allowed.

but if someone enters,

"1,2,,3" this would not be allowed.

allowed multiple commas but not like above.

Thanks in advance

  • 写回答

7条回答 默认 最新

  • duanlao6573 2015-05-30 07:39
    关注

    Try this,

    if(in_array("", explode(',',$str)))
    {
        // validation fail
    }
    
    评论

报告相同问题?