var friends = ["Tom","Joe"];
//friends=friends.toString();
res.render('index', {
title : '欢迎来到我的主页',
friends : friends
});
//view模板用的是ejs,在index里面<%=friends%>获取不了friends哎~ //字符串接收是好的,怎么获取friends呢~ ~
var friends = ["Tom","Joe"];
//friends=friends.toString();
res.render('index', {
title : '欢迎来到我的主页',
friends : friends
});
//view模板用的是ejs,在index里面<%=friends%>获取不了friends哎~ //字符串接收是好的,怎么获取friends呢~ ~
对不住啊,这个不知道怎么回事,上午还接收不了= =,现在又可以了,数组,json都可以了,谢谢了!!
你的friends是个数组,你需要循环遍历这个数组
试试friends.length