在 PHP 中我们有:
echo '<a href="mycgi?foo=', urlencode($userinput), '">';
Run Code Online (Sandbox Code Playgroud)
NodeJs 版本是什么urlencode();
小智 6
是你需要的吗? 网址编码
在这种情况下,可能与nodejs无关,在客户端仅使用javacript函数encodeURIComponent进行编码
例如:
var apiUrl: string = 'mycgi?foo=';
apiUrl += encodeURIComponent(userInput)
Run Code Online (Sandbox Code Playgroud)
归档时间: |
|
查看次数: |
8990 次 |
最近记录: |