zoukankan      html  css  js  c++  java
  • PHP 判断密码强度

     
               $score = 0;
               if(preg_match("/[0-9]+/",$str))
               {
                  $score ++; 
               }
               if(preg_match("/[0-9]{3,}/",$str))
               {
                  $score ++; 
               }
               if(preg_match("/[a-z]+/",$str))
               {
                  $score ++; 
               }
               if(preg_match("/[a-z]{3,}/",$str))
               {
                  $score ++; 
               }
               if(preg_match("/[A-Z]+/",$str))
               {
                  $score ++; 
               }
               if(preg_match("/[A-Z]{3,}/",$str))
               {
                  $score ++; 
               }
               if(preg_match("/[_|-|+|=|*|!|@|#|$|%|^|&|(|)]+/",$str))
               {
                  $score += 2; 
               }
               if(preg_match("/[_|-|+|=|*|!|@|#|$|%|^|&|(|)]{3,}/",$str))
               {
                  $score ++ ; 
               }
               if(strlen($str) >= 10)
               {
                  $score ++; 
               }
               echo "<br>";
               echo $score;
  • 相关阅读:
    关于String
    MySQL中count(1)、count(*) 与 count(列名) 的执行区别?
    OSC的原理
    [java] 模拟QPS
    [java] 简单的ConcurrentHashMap
    [java] 线程池
    [Guava] EventBus
    [jvm]垃圾回收算法
    [zookeeper] Zookeeper概述
    [NS2]TCL语言基本语法
  • 原文地址:https://www.cnblogs.com/caorui-log/p/10711487.html
Copyright © 2011-2022 走看看