doudang2537 2012-03-23 10:21
浏览 27
已采纳

蛋糕php中的移动验证问题

1.Need 10 digit mobile No(working)

2.Can be start 0-9(working)

3.not more then 10 digit(not working->that required not working it's take also more than 10 digit like exp 11, 12 digit and more also )

for that i have implement that rule

'mobile_no' =>array(
'rule'=>array('custom','/([0-9]{1}[0-9]{9})/'),
'allowEmpty'=>false, 
'message'=>'Invalid mobile number! mobile number format: eg 0755434434'
 ),

so i want to know where is problem in my code related to 3rd point

thanks in adv

  • 写回答

3条回答 默认 最新

  • dsjuimtq920056 2012-03-23 10:54
    关注

    The problem is that your regex says "match anything that contains a 10-digit phone number", however, what you really want is "match any string with 10 characters that is a phone number".

    The following regex should fix the issue: /^([0-9]{1}[0-9]{9})$/

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(2条)

报告相同问题?

悬赏问题

  • ¥15 关于用pyqt6的项目开发该怎么把前段后端和业务层分离
  • ¥30 线性代数的问题,我真的忘了线代的知识了
  • ¥15 有谁能够把华为matebook e 高通骁龙850刷成安卓系统,或者安装安卓系统
  • ¥188 需要修改一个工具,懂得汇编的人来。
  • ¥15 livecharts wpf piechart 属性
  • ¥20 数学建模,尽量用matlab回答,论文格式
  • ¥15 昨天挂载了一下u盘,然后拔了
  • ¥30 win from 窗口最大最小化,控件放大缩小,闪烁问题
  • ¥20 易康econgnition精度验证
  • ¥15 msix packaging tool打包问题