摘要: fs.readFile('.'+urls, function (err, data) { res.end(data) }); 阅读全文
posted @ 2019-05-27 10:39 武卡卡 阅读(177) 评论(0) 推荐(0) 编辑
摘要: const http = require('http'); const fs = require('fs'); const server = http.createServer(); server.on('request', function (req, res) { // 根据每次请求的文件类型给 阅读全文
posted @ 2019-05-27 10:26 武卡卡 阅读(360) 评论(0) 推荐(0) 编辑
摘要: const http = require('http'); const fs = require('fs'); const server = http.createServer(); server.on('request',function(req,res){ res.writeHead(200, 阅读全文
posted @ 2019-05-26 16:00 武卡卡 阅读(208) 评论(1) 推荐(0) 编辑
摘要: const http = require('http'); const server = http.createServer(); server.on('request',function(req,res){ res.writeHead(200, {'Content-Type': 'text/htm 阅读全文
posted @ 2019-05-26 13:22 武卡卡 阅读(92) 评论(0) 推荐(0) 编辑
摘要: const http = require('http'); const server = http.createServer(); // 绑定客户端请求事件 // on => 绑定事件 // request => 请求事件 // 为 nodejs 系统调用 (因为是nodejs调用) // 给ser 阅读全文
posted @ 2019-05-26 12:44 武卡卡 阅读(469) 评论(0) 推荐(1) 编辑
摘要: 思想 : 先读取 , 再追加 const fs = require('fs') fs.readFile("./hello.txt","utf-8",(err,data)=>{ if(!err){ fs.writeFile("./hello.txt",data+" 追加内容 ",(err)=>{ if 阅读全文
posted @ 2019-05-25 15:48 武卡卡 阅读(375) 评论(0) 推荐(0) 编辑
摘要: nodejs =》 提供核心模块语法 node中的回调函数 都是异步 阅读全文
posted @ 2019-05-25 15:36 武卡卡 阅读(84) 评论(0) 推荐(0) 编辑
摘要: 1,作用域链 2,原型链 3,闭包 阅读全文
posted @ 2019-05-24 10:41 武卡卡 阅读(617) 评论(0) 推荐(0) 编辑
摘要: 一,声明对象 var obj1 = {}; var obj2 = {name:'kk',age:18,fun:function{ // name,age,fun为对象的属性,只是属性值不同 console.log(123); return 1; }}; console.log(obj2.fun) / 阅读全文
posted @ 2019-05-23 20:17 武卡卡 阅读(340) 评论(0) 推荐(0) 编辑
摘要: 一,数据类型 字符串 。 数值 。布尔。 null 。 undefined 。 对象 ( 数组 。 函数 function(){} 。 object) undefined 出现的情景 : (1)变量声明且没有赋值 (2)获取对象中不存在的属性 (3)函数有形参,但调用时没有传值 。 形参的值是und 阅读全文
posted @ 2019-05-23 09:47 武卡卡 阅读(173) 评论(0) 推荐(0) 编辑