久久久久久久视色,久久电影免费精品,中文亚洲欧美乱码在线观看,在线免费播放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. 站長(zhǎng)資訊網(wǎng)
      最全最豐富的資訊網(wǎng)站

      php如何生成不重復(fù)隨機(jī)字符串

      php生成不重復(fù)隨機(jī)字符串的方法:1、使用時(shí)間戳作為原始字符串,再隨機(jī)生成五個(gè)字符隨機(jī)插入任意位置,生成新的字符串,代碼為【$position=rand()%strlen($chars)】;2、使用【array_slice】函數(shù)隨機(jī)抽取。

      php如何生成不重復(fù)隨機(jī)字符串

      php生成不重復(fù)隨機(jī)字符串的方法:

      1、使用時(shí)間戳作為原始字符串,再隨機(jī)生成五個(gè)字符隨機(jī)插入任意位置,生成新的字符串,保證不重復(fù)

      function rand($len)     {         $chars='ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789abcdefghijklmnopqrstuvwxyz';         $string=time();         for(;$len>=1;$len--)         {             $position=rand()%strlen($chars);             $position2=rand()%strlen($string);             $string=substr_replace($string,substr($chars,$position,1),$position2,0);         }         return $string;     }

      2、使用array_slice()函數(shù)隨機(jī)抽取

      <?php $numbers = range (1,50); //shuffle 將數(shù)組順序隨即打亂 shuffle ($numbers); //array_slice 取該數(shù)組中的某一段 $num=6; $result = array_slice($numbers,0,$num); print_r($result); ?>

      相關(guān)學(xué)習(xí)推薦:php編程(視頻)

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