And you didn’t write in the route of addroom.html: 🎜
rrreee
🎜So naturally I can’t find it. 🎜
🎜If you want ejs to directly obtain the information in session, you can try to use locals, such as prefixing a middleware: 🎜
rrreee
🎜In this way, you can directly use <%= userid %> in your ejs template🎜
The
userid
is given inroomview.html
:roomview.html
里给了userid
:而
addroom.html
的路由里你没写:所以自然找不到。
如果你希望
ejs
里可以直接获取session
里的信息,可以尝试使用locals
,比如前置一个中间件:这样,你的
And you didn’t write in the route ofejs
模版里就可以直接使用<%= userid %>
rrreeeaddroom.html
: 🎜 rrreee 🎜So naturally I can’t find it. 🎜 🎜If you wantejs
to directly obtain the information insession
, you can try to uselocals
, such as prefixing a middleware: 🎜 rrreee 🎜In this way, you can directly use<%= userid %>
in yourejs
template🎜The pictures I drew are quite beautiful