function rand_word($num=12){ $re=''; $list="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ~0123456789#$%^&"; $list=str_split($list); $key = array_rand($list,$num); foreach($key as $value){ $re .= $list[$value]; } return $re;