There are many template engines for nodejs, and ejs is relatively simple and easy to use. Some commonly used syntax:
Use <%...%> to include js code
Use <%=... %>Output variable If the variable contains characters such as '<' '>' '&', it will be escaped
Use <%-...%> to output the variable Without escaping
Use <%- include('user/show') %> to introduce other templates Include ./user/show.ejs
Use <%# some comments %> to comment, no execution or output
<%% is escaped as '<% '
The above is the detailed content of Summary of common grammar of ejs. For more information, please follow other related articles on the PHP Chinese website!