php
<?php
function generateRandomString($length = 32) {
$characters = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ';
$charactersLength = strlen($characters);
$randomString = '';
for ($i = 0; $i < $length; $i++) {
$randomString .= $characters[rand(0, $charactersLength - 1)];
}
return $randomString;
}
$randomString = generateRandomString();
echo $randomString; // 输出一个长度为32的随机字符串
?>
顶一下
(0)
0%
踩一下
(0)
0%
- 相关评论
- 我要评论
-