跳到主要内容
CNode

node http请求数目问题

问答
Ppiaoliuhuanjing发布于 11 年前最后回复 11 年前
545210

直接上代码:app.js var http = require('http'); var index =0; http.createServer(function(req,res){ res.writeHead(200,{'content-type':'text/html'}); res.write('

Node.js

'); res.end('

Hello World

'); console.log(' has a request ...'+index); index++; }).listen(3000); console.log('http server is listening at prot 3000');

使用火狐(IE11)http://localhost:3000访问时,刷新一次,控制台就打印一条 :has a request ...1 我换成了用360(chrome 版本为36.0.1985.143)来访问,刷新一次,控制台就会打印两条:has a request ...2 has a request ...3 想请教一下,是什么原因?(本人刚学)

查看回复

回复 (5)

P
piaoliuhuanjing#511 年前

非常感谢各位的帮我解惑,试了一下,可以了 if(req.url !='/favicon.ico'){ dosomething...... }

W
wp3xpp#411 年前
引用 summerGreenTea想问下 什么叫favicon呢?

@summerGreenTea 浏览器分页窗口左上方的那个图标

S
summerGreenTea#311 年前

想问下 什么叫favicon呢?

M
motelinden#211 年前

if(req.url.pthname != '/facicon'){ dosomething... }

L
leapon#111 年前

经典nodejs问题。一个是 favicon

参与回复

登录后即可参与回复。登录