PHP生成随机字符串
<?php
function generateRandomString($length = 10) {
$characters = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ';
$randomString = '';
for ($i = 0; $i < $length; $i++) {
$randomString .= $characters[rand(0, strlen($characters) - 1)];
}
return $randomString;
?>
<?php
echo generateRandomString(20);
?>
当前页面是本站的「Google AMP」版。查看和发表评论请点击:完整版 »