$account] 或 ['email' => $account] */ function normalizeAccount(string $account): array { // 使用FILTER_VALIDATE_EMAIL验证邮箱格式 if (filter_var($account, FILTER_VALIDATE_EMAIL)) { return ['email' => $account]; } // 清理手机号中的非数字字符 $cleanPhone = preg_replace('/[^0-9]/', '', $account); // 验证手机号格式(简单版:11位数字) if (preg_match('/^1[3-9]\d{9}$/', $cleanPhone)) { return ['phone' => $cleanPhone]; } // 如果既不是邮箱也不是手机号,根据业务需求处理 // 这里默认按手机号处理(可根据实际需求调整) return ['phone' => $cleanPhone]; } /** * 公共html页面 */ function htmlpage() { static $html; if (!$html) { $html = file_get_contents(public_path('mzl.html')); } return $html; }