koa的controller要返回html内容该怎么做?
 发布于 9 年前  作者 xupeng086  6003 次预览  最后一次回复是 9 年前  来自 问答 

生成的html,到页面上<%=str%> (ejs模版)展示后尖括号全部变成了 “& l t ; a ”,怎么防止被编码? 或者我就不该这么生成html?

3 回复
Jerry-M

这个koa没关系。返回原html应该<%- str %> , 我印象中是这样

wssgcg1213

@xupeng086 你应该先去看看 ejs 的语法, <%= %> 的语法是会转义的 (Escaped output with <%= %> (escape function configurable)) https://npm.mirror.cqupt.edu.cn/package/ejs