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
代码如下:
var http = require('http'); var svr = new http.Server(9005, function(r){ console.log(r.query.id) r.response.write('x'); }); svr.run();
浏览器中打开网址http://localhost:9005/?qq=2&id=3 命令行中输入如下:
http://localhost:9005/?qq=2&id=3
3 undefined
貌似是执行了两次。第二次r.query为空。因此无法输出id。
如果上面的代码改为
var http = require('http'); var svr = new http.Server(9005, function(r){ // console.log(r.query.id) r.response.write(r.query.id); }); svr.run();
浏览器中看到输出只有3,没有undefined。
初次接触,不知是何缘故。
The text was updated successfully, but these errors were encountered:
确认 bug,正在检查,多谢。
Sorry, something went wrong.
执行了两次是正确的,因为浏览器会请求 http://localhost:9005/?qq=2&id=3 和 http://localhost:9005/favicon.ico,因此第二次请求会出现 undefined。
No branches or pull requests
代码如下:
浏览器中打开网址
http://localhost:9005/?qq=2&id=3
命令行中输入如下:
貌似是执行了两次。第二次r.query为空。因此无法输出id。
如果上面的代码改为
浏览器中看到输出只有3,没有undefined。
初次接触,不知是何缘故。
The text was updated successfully, but these errors were encountered: