random() 函数:来自DZ源代码
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
| <pre class="brush:php">function random($length) { $hash = ""; $chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789abcdefghijklmnopqrstuvwxyz"; $max = strlen($chars) - 1; PHP_VERSION < "4.2.0" && mt_srand((double)microtime() * 1000000); for($i = 0; $i < $length; $i++) { $hash .= $chars[mt_rand(0, $max)]; } return $hash; }
<br>
|
如果觉得我的文章对您有用,请随意打赏。您的支持将鼓励我继续创作!
微信支付
支付宝