nodejs基于art-template模板引擎生成

xiaoxiao2021-02-28  5

基础核心代码

var template = require('art-template'); var tName = new Date().getTime(); var htmlT = '<!DOCTYPE html><html lang="en"><head><meta charset="UTF-8"><title></title></head><body><h1>{{title}}</h1></body></html>'; template(tName, htmlT); var html = template.renderFile(tName, {title: '大家好,我叫小白~'}); console.log("结果: " + html); res.end();

运行结果:

 

转载请注明原文地址: https://www.6miu.com/read-2350182.html

最新回复(0)