我知道如何为这样的查询获取参数:
app.get('/sample/:id', routes.sample);
在这种情况下,我可以使用req.params.id
获取参数(例如2
中的/sample/2
)。
但是,对于url like /sample/2?color=red
,如何访问变量color
?
我试过了,req.params.color
但是没有用。
如何在“?”之后访问GET参数?在快递?
我知道如何为这样的查询获取参数:
app.get('/sample/:id', routes.sample);
在这种情况下,我可以使用req.params.id
获取参数(例如2
中的/sample/2
)。
但是,对于url like /sample/2?color=red
,如何访问变量color
?
我试过了,req.params.color
但是没有用。
第1837篇《如何在“?”之后访问GET参数?在快递?》来自Winter(https://github.com/aiyld/aiyld.github.io)的站点
相似问题
问题类别