We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
querystring用来对url中的query字符串进行解析,常用的方法有querystring.parse和querystring.stringify。
querystring.parse方法用于解析URL 查询字符串。
示例代码:/lesson14/querystring.js
代码如下:
const querystring = require('querystring') console.log(querystring.parse('foo=bar&abc=xyz&abc=123'))
解析结果为:
{ foo: 'bar', abc: [ 'xyz', '123' ] }
querystring.stringify用于将对象转换为URL查询字符串。
console.log(querystring.stringify({ foo: 'bar', baz: ['qux', 'quux'], corge: '' }))
foo=bar&baz=qux&baz=quux&corge=
The text was updated successfully, but these errors were encountered:
No branches or pull requests
阅读更多系列文章请访问我的GitHub博客,示例代码请访问这里。
querystring
querystring用来对url中的query字符串进行解析,常用的方法有querystring.parse和querystring.stringify。
querystring.parse
querystring.parse方法用于解析URL 查询字符串。
代码如下:
解析结果为:
querystring.stringify
querystring.stringify用于将对象转换为URL查询字符串。
代码如下:
解析结果为:
The text was updated successfully, but these errors were encountered: