PHP 隨機亂碼

作者 Kelvin Huang

使用 PHP 產生隨機亂碼

隨機數字

<?php

$random_number = rand(1, 1000);

echo "隨機數字為:" . $random_number;

?>

 

隨機數字 + 文字

<?php

$random_string = substr(str_shuffle("0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"), 0, 10);

echo "隨機亂碼為:" . $random_string;

?>