Sean Wei says to YSITD
超簡陋的 ``` <?php include('function.php'); $json = file_get_contents('php://input') . PHP_EOL; $data = json_decode($json, True); $ChatID = $data['message']['chat']['id']; $MsgID = $data['message']['message_id']; if (!isset($data['message']['text'])) { exit; } if (strtolower(substr($data['message']['text'], 0, 4)) == '/gen') { $pw = genPW(); sendMsg(Array( 'bot' => 'pwd', 'chat_id' => $ChatID, 'reply_to_message_id' => $MsgID, 'text' => "You Unique Strong Password is: *{$pw}*", 'parse_mode' => 'Markdown', )); } function genPW () { $length = 16; $set = ''; $set .= 'abcdefghjkmnpqrstuvwxyz'; $set .= 'ABCDEFGHJKMNPQRSTUVWXYZ'; $set .= '23456789'; $set .= '!@#$%&?'; $set = str_split($set); $password = ''; for ($i = 0; $i < $length; $i++) { $password .= $set[array_rand($set)]; } return $password; } echo genPW(); ```