生成自定义随机字符串的方法
看代码:
function generate_custom_key($length = 8 ) { $chars = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789!@#$%^&*()-_ []{}<>~`+=,.;:/?|'; $charslen = strlen($chars); $str = ''; for($i = 0; $i < $length; $i++ ) { $str .= $chars[mt_rand(0, $charslen - 1)]; } return $str; }
绝对随机,绝对难破解,有没有发现?
What a neat article. I had no inknlig.