【发布时间】:2025-12-14 19:55:01
【问题描述】:
我想转义 bloglist[i].Text 字段中的 html。如何用 EJS 做到这一点?
<!DOCTYPE html>
<html>
<head>
<title><%= title %></title>
<link rel='stylesheet' href='/stylesheets/style.css' />
</head>
<body>
<h1><%= title %></h1>
<p>Welcome to <%= title %></p>
<% for(var i=0; i < bloglist.length; i++) { %>
<h3> <%= bloglist[i].Title %></h3>
<div>
<%= bloglist[i].Text %>
</div>
<% } %>
</body>
</html>
【问题讨论】: