📜  rand 字符串 php 代码示例

📅  最后修改于: 2022-03-11 14:54:34.681000             🧑  作者: Mango

代码示例6
function RandomString()
    {
        $characters = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ';
        $randstring = '';
        for ($i = 0; $i < 10; $i++) {
            $randstring = $characters[rand(0, strlen($characters))];
        }
        return $randstring;
    }