gpt4 book ai didi

node.js - 如何使用 ejs 快速获取当前 url 路径

转载 作者:搜寻专家 更新时间:2023-10-31 23:32:25 29 4
gpt4 key购买 nike

我想在 Nodejs 中搜索浏览器查询如何使用 Ejs 获取当前页面 URL Express

最佳答案

协议(protocol)作为 req.protocol 可用。 docs here

var fullUrl = req.protocol + '://' + req.get('host') + req.originalUrl;

通过上面的例子,你可以得到整页的URL。

关于node.js - 如何使用 ejs 快速获取当前 url 路径,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42943124/

29 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com