<?php
header("content-type:text/html; charset=utf-8");
function random($length, $chars = '0123456789') {
$hash = '';
$max = strlen($chars) - 1;
for($i = 0; $i < $length; $i++) {
$hash .= $chars[mt_rand(0, $max)];
}
return $hash;
}
$length=isset($_GET['length'])?$_GET['length']:'6';
echo "<h1>".random($length, '123456789abcdefghijklmnpqrstuvwxyzABCDEFGHIJKLMNPQRSTUVWXYZ')."</h1>";
php生成随机数据(数字、大小写字母混合)
最新推荐文章于 2023-06-12 17:12:07 发布