<?php
/**
 * @param $pwd
 * @return string
 */
function isPwd($pwd){
    $pattern= '/^[0-9a-z_$]{6,16}$/i'; // i 不区分大小写
    if(preg_match($pattern,$pwd)){
        return '合法';
    }else{
        return '不合法';
    }
}

echo isPwd('123').PHP_EOL;
echo isPwd('abc').PHP_EOL;
echo isPwd('123aBc').PHP_EOL;
echo isPwd('123456').PHP_EOL;
echo isPwd('J123456_').PHP_EOL;

相关文章:

  • 2021-08-10
  • 2021-09-24
  • 2021-06-28
  • 2022-12-23
  • 2022-12-23
  • 2021-05-28
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2021-12-03
  • 2022-12-23
  • 2022-01-28
  • 2022-12-23
  • 2022-12-23
  • 2021-12-24
相关资源
相似解决方案