Browse Source

随机数

linwu 9 tháng trước cách đây
mục cha
commit
c87c1b7bc9
1 tập tin đã thay đổi với 1 bổ sung1 xóa
  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;