在Rails的ERB模板中, 经常会用到HTML转义, 最近使用Sinatra, 发现用不了, 最后搜到了这篇文章:
Rails:
<%=h article.author %>
Sinatra:
helpers do
alias_method :h, :escape_html
end
本文地址:http://www.dujinfang.com/past/2009/11/1/sinatra-zhong-erb-mo-ban-de-html-zhuan-yi/
短地址:
-------------------------------------------------------------------------------------------
给我留言 | Leave a comment
------ ^_^ ------------------------------------------------------------------------7-------