node.js中的http.response.write方法使用说明
方法说明:
向请求的客户端发送响应内容。
在response.end()之前,response.write()可以被执行多次。
语法:
response.write(chunk,[encoding])
参数:
chunk 是一个buffer或字符串,表示发送的内容
encoding 如果chunk是字符串,就需要指定encoding来说明它的编码方式,默认utf-8
例子:
varhttp=require('http');
http.createServer(function(req,res){
res.writeHead(200,{'Content-type':'text/html'});
res.write('<h1>Node.js</h1>');
res.end('<p>HelloWorld</p>');
}).listen(3000);
热门推荐
10 小红书平安祝福语简短
11 生日祝福语大全女孩简短
12 收生日红包祝福语 简短
13 领证幽默祝福语简短
14 法考面试祝福语简短
15 老哥出门祝福语简短语
16 送灯祝福语简短独特
17 幼儿狗年祝福语大全简短
18 好听的元旦简短祝福语