• PHP生成随机字符串


    <?php
    
     class RandChar{
    
      function getRandChar($length){
       $str = null;
       $strPol = "ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789abcdefghijklmnopqrstuvwxyz";
       $max = strlen($strPol)-1;
    
       for($i=0;$i<$length;$i++){
        $str.=$strPol[rand(0,$max)];//rand($min,$max)生成介于min和max两个数之间的一个随机整数
       }
    
       return $str;
      }
     }
    
     $randCharObj = new RandChar();
     echo $randCharObj->getRandChar(5);
    ?>

    80个随机字符串生成

    <?php
    class RandChar{
    
      function getRandChar($length){
       $str = null;
       $strPol = "0123456789abcdefghijklmnopqrstuvwxyz";
       $max = strlen($strPol)-1;
    
       for($i=0;$i<$length;$i++){
        $str.=$strPol[rand(0,$max)];//rand($min,$max)生成介于min和max两个数之间的一个随机整数
       }
    
       return $str;
      }
     }
    
     $randCharObj = new RandChar();
    $word=array($randCharObj->getRandChar(5),$randCharObj->getRandChar(5),$randCharObj->getRandChar(5),$randCharObj->getRandChar(5),$randCharObj->getRandChar(5),$randCharObj->getRandChar(5),$randCharObj->getRandChar(5),$randCharObj->getRandChar(5),$randCharObj->getRandChar(5),$randCharObj->getRandChar(5));
    $word1=array($randCharObj->getRandChar(5),$randCharObj->getRandChar(5),$randCharObj->getRandChar(5),$randCharObj->getRandChar(5),$randCharObj->getRandChar(5),$randCharObj->getRandChar(5),$randCharObj->getRandChar(5),$randCharObj->getRandChar(5),$randCharObj->getRandChar(5),$randCharObj->getRandChar(5));
    $word2=array($randCharObj->getRandChar(5),$randCharObj->getRandChar(5),$randCharObj->getRandChar(5),$randCharObj->getRandChar(5),$randCharObj->getRandChar(5),$randCharObj->getRandChar(5),$randCharObj->getRandChar(5),$randCharObj->getRandChar(5),$randCharObj->getRandChar(5),$randCharObj->getRandChar(5));
    $word3=array($randCharObj->getRandChar(5),$randCharObj->getRandChar(5),$randCharObj->getRandChar(5),$randCharObj->getRandChar(5),$randCharObj->getRandChar(5),$randCharObj->getRandChar(5),$randCharObj->getRandChar(5),$randCharObj->getRandChar(5),$randCharObj->getRandChar(5),$randCharObj->getRandChar(5));
    $word4=array($randCharObj->getRandChar(5),$randCharObj->getRandChar(5),$randCharObj->getRandChar(5),$randCharObj->getRandChar(5),$randCharObj->getRandChar(5),$randCharObj->getRandChar(5),$randCharObj->getRandChar(5),$randCharObj->getRandChar(5),$randCharObj->getRandChar(5),$randCharObj->getRandChar(5));
    $word5=array($randCharObj->getRandChar(5),$randCharObj->getRandChar(5),$randCharObj->getRandChar(5),$randCharObj->getRandChar(5),$randCharObj->getRandChar(5),$randCharObj->getRandChar(5),$randCharObj->getRandChar(5),$randCharObj->getRandChar(5),$randCharObj->getRandChar(5),$randCharObj->getRandChar(5));
    $word6=array($randCharObj->getRandChar(5),$randCharObj->getRandChar(5),$randCharObj->getRandChar(5),$randCharObj->getRandChar(5),$randCharObj->getRandChar(5),$randCharObj->getRandChar(5),$randCharObj->getRandChar(5),$randCharObj->getRandChar(5),$randCharObj->getRandChar(5),$randCharObj->getRandChar(5));
    $word7=array($randCharObj->getRandChar(5),$randCharObj->getRandChar(5),$randCharObj->getRandChar(5),$randCharObj->getRandChar(5),$randCharObj->getRandChar(5),$randCharObj->getRandChar(5),$randCharObj->getRandChar(5),$randCharObj->getRandChar(5),$randCharObj->getRandChar(5),$randCharObj->getRandChar(5));
    print_r($word);echo "<br />";
    print_r($word1);echo "<br />";
    print_r($word2);echo "<br />";
    print_r($word3);echo "<br />";
    print_r($word4);echo "<br />";
    print_r($word5);echo "<br />";
    print_r($word6);echo "<br />";
    print_r($word7);echo "<br />";
    
    ?>
  • 相关阅读:
    全表扫描
    服务器信息表
    事务的丢失更新
    oracle core 概述
    oracle命中率模型计算
    性能量化之cpu
    一个sql导致temp表空间爆掉
    oracle稳定执行计划1
    oracle热点表online rename
    oracle构建一致性读
  • 原文地址:https://www.cnblogs.com/lyg0126/p/6201252.html
Copyright © 2020-2023  润新知