久久久久久久视色,久久电影免费精品,中文亚洲欧美乱码在线观看,在线免费播放AV片

<center id="vfaef"><input id="vfaef"><table id="vfaef"></table></input></center>

    <p id="vfaef"><kbd id="vfaef"></kbd></p>

    
    
    <pre id="vfaef"><u id="vfaef"></u></pre>

      <thead id="vfaef"><input id="vfaef"></input></thead>

    1. 站長資訊網(wǎng)
      最全最豐富的資訊網(wǎng)站

      php如何能隨機(jī)生成驗證碼

      本篇文章給大家介紹一下php隨機(jī)生成驗證碼的方法。有一定的參考價值,有需要的朋友可以參考一下,希望對大家有所幫助。

      php如何能隨機(jī)生成驗證碼

      <?php /*  * 方法類  * */ class functions {     /**      * PHP隨機(jī)生成驗證碼函數(shù)      *      * @param array      * @return  mixed      */     function randCode($params = [])     {         $num = $params['num'] ?? 4; //驗證碼個數(shù)         $isLetter = $params['isLetter'] ? $params['isLetter'] : 1; //1是純數(shù)字 2是字母和數(shù)字的組合          if($isLetter==1){             for($i=1;$i<=$num;$i++){                 $codeMin.=0;                 $codeMax.=9;             }             return rand($codeMin,$codeMax);         }          if($isLetter==2){             //如果想調(diào)整權(quán)重,自己可以根據(jù)需求修改$codeArr這個一位數(shù)組             $codeArr = ['1','2','3','4','5','6','7','8','9','0','a','b','c','d','e','f','g','h','i',             'j','k','l','m','n','o','p','q','e','s','t','u','v','w','x','y','z',             '1','2','3','4','5','6','7','8','9','0'];             $codeKeys = array_rand($codeArr,$num);             shuffle($codeKeys);             foreach ($codeKeys as $codeValue){                 $codeStr .= $codeArr[$codeValue];             }             return $codeStr;         }     } }  //測試生成驗證碼方法 $re = (new functions())->randCode([     'num'      => 6, //需要的個數(shù)     'isLetter' => 2, //1是純數(shù)字 2是數(shù)字加字符串 ]); print_r($re);

      測試結(jié)果如下

      php如何能隨機(jī)生成驗證碼

      推薦學(xué)習(xí):php視頻教程

      贊(0)
      分享到: 更多 (0)
      網(wǎng)站地圖   滬ICP備18035694號-2    滬公網(wǎng)安備31011702889846號