gpt4 book ai didi

node.js - 使用 HTML 连接 Flash 消息?

转载 作者:搜寻专家 更新时间:2023-10-31 23:35:32 24 4
gpt4 key购买 nike

我想在连接闪存消息的文本中包含一个链接:

JS

req.flash("registerMessage", "Sorry, the User ID you chose is already in use. Please choose another. If you have already registered and need assistance logging in, <a href=\"http://www.example.com/support/\">contact support</a>");

EJS

<% if (message.length > 0) { %>
<div class="alert alert-danger"><%= message %></div>
<% } %>

结果

<div class="alert alert-danger">Sorry, the User ID you chose is already in use. Please choose another. If you have already registered and need assistance logging in, &lt;a href=&quot;http://www.example.com/support/&quot;&gt;contact support&lt;/a&gt;.</div>

有没有办法防止 flash 转义 HTML 字符,以便我可以在消息中显示链接?

最佳答案

你可以使用:

<%- message %> 

输出未转义的HTML

关于node.js - 使用 HTML 连接 Flash 消息?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26329941/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com