Browse Source

随机数

linwu 9 months ago
parent
commit
c87c1b7bc9
1 changed files with 1 additions and 1 deletions
  1. 1 1
      app/common.php

+ 1 - 1
app/common.php

@@ -18,7 +18,7 @@ function rand_str($len = 6)
     $str = "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
     $res = '';
     for ($i = 0; $i < $len; $i++) {
-        $key = rand(0, strlen($str));
+        $key = rand(0, strlen($str) - 1);
         $res .= $str[$key];
     }
     return $res;