我如何在Node.js中对URl进行编码? [英] How do I URl encode something in Node.js?
本文介绍了我如何在Node.js中对URl进行编码?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想对此进行URL编码:
I want to URL encode this:
SELECT name FROM user WHERE uid = me()
我是否必须为此下载模块?我已经有了请求模块。
Do I have to download a module for this? I already have the request module.
推荐答案
你可以使用JavaScript的 encodeURIComponent
:
You can use JavaScript's encodeURIComponent
:
encodeURIComponent('select * from table where i()')
这篇关于我如何在Node.js中对URl进行编码?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文