私人领地

php 生成随机字符串 abcdeft....789

private function createNonceStr($length = 16) {
    $chars = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";
    $str = "";
    for ($i = 0; $i < $length; $i++) {
      $str .= substr($chars, mt_rand(0, strlen($chars) - 1), 1);
    }
    return $str;
  }

 

posted @ 2016-01-08 15:01  狂奔的蜗牛Snails  阅读(228)  评论(0编辑  收藏  举报