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 SQL Server下载
  • ¥15 python如何将动态的多个子列表,拼接后进行集合的交集
  • ¥20 vitis-ai量化基于pytorch框架下的yolov5模型
  • ¥15 如何实现H5在QQ平台上的二次分享卡片效果?
  • ¥15 python爬取bilibili校园招聘网站
  • ¥30 求解达问题(有红包)
  • ¥15 请解包一个pak文件
  • ¥15 不同系统编译兼容问题
  • ¥100 三相直流充电模块对数字电源芯片在物理上它必须具备哪些功能和性能?
  • ¥30 数字电源对DSP芯片的具体要求