php中的随机数生成器
you can use rand() function for that in php.
Example:
Generate random numbers between 1 to 50
<?php
echo rand(1,50);
?>
php随机字符串
function rand_str() {
$characters = '0123456789-=+{}[]:;@#~.?/>,<|\!"£$%^&*()abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ';
$randomstr = '';
for ($i = 0; $i < random_int(50, 100); $i++) {
$randomstr .= $characters[rand(0, strlen($characters) - 1)];
}
return $randomstr;
}
php随机数生成器
<?php
echo rand(1,50);
?>
php rand int
random_int ( int $min , int $max );
php随机整数
echo random_int(0,50);
php随机数
rand(0,10);
or
random_int(0,10)
php随机
mt_rand(1000, 9999)