摘要: typeof的运算数未定义,返回的就是 "undefined". 运算数为数字 typeof(x) = "number" 字符串 typeof(x) = "string" 布尔值 typeof(x) = "boolean" 对象,数组和null typeof(x) = "object" 函数 typ 阅读全文
posted @ 2017-08-27 21:08 开始战斗 阅读(484) 评论(0) 推荐(0) 编辑
摘要: <tr> <td align='left'>手持证件照:</td><td><input type="file" name="photo" id="idphotoView" onchange="idphotoChange(this.id,'imgPre');" /> <img id="imgPre" 阅读全文
posted @ 2017-08-27 21:06 开始战斗 阅读(157) 评论(0) 推荐(0) 编辑
摘要: 1.Node.js Express 框架安装:npm install express --save在当前目录下创建一个node_modules 2.安装必要的中间件npm install body-parser --savenpm install cookie-parser --savenpm in 阅读全文
posted @ 2017-08-27 13:59 开始战斗 阅读(238) 评论(0) 推荐(0) 编辑
摘要: 1.安装express-session npm install express-session --save-dev //注意-g无效 2.app.jsvar session = require('express-session'); app.use(cookieParser()); //必须在此行 阅读全文
posted @ 2017-08-27 11:46 开始战斗 阅读(503) 评论(0) 推荐(0) 编辑
摘要: 生成一个node项目1.创建文件夹2.文件夹中右键->在此处打开命令窗口->文件夹中打开dos3.执行:npm init //一路回车,最后y4.安装插件: C:\www\nodejs\hello>npm install async --save-dev 阅读全文
posted @ 2017-08-27 11:41 开始战斗 阅读(358) 评论(0) 推荐(0) 编辑
摘要: 1.同步:var async = require("async"); async.series([step1, step2, step3],function(err, values) { do somethig with the err or values v1v2v3});var async = 阅读全文
posted @ 2017-08-27 11:16 开始战斗 阅读(761) 评论(0) 推荐(0) 编辑
摘要: http://cnodejs.org/topic/54acfbb5ce87bace2444cbfb 先安装:G:\www\nodejs\one\models>npm install async --save-dev 1.串行无关联:async.series(tasks,callback);多个函数依 阅读全文
posted @ 2017-08-27 11:16 开始战斗 阅读(170) 评论(0) 推荐(0) 编辑
摘要: var async = require('async'); //串行无关联series//串行有关联waterfall//并行:parallel //会把各个函数的执行结果一起放到最后的回调中async.parallel([ function(cb) { setTimeout(function(){ 阅读全文
posted @ 2017-08-27 11:15 开始战斗 阅读(194) 评论(0) 推荐(0) 编辑
摘要: var async = require('async'); //串行无关联series//串行有关联waterfallasync.waterfall([ function(cb) { setTimeout(function(){ console.log('111111111'); cb(null, 阅读全文
posted @ 2017-08-27 11:14 开始战斗 阅读(377) 评论(0) 推荐(0) 编辑
摘要: var async = require('async'); //串行无关联async.series({ one:function(cb) { setTimeout(function(){ console.log('111111111'); cb('有错', 1); }, 3000); }, two: 阅读全文
posted @ 2017-08-27 11:13 开始战斗 阅读(267) 评论(0) 推荐(0) 编辑
摘要: 方法一: 支持中文,图片显示 // 文件上传 router.post('/imgupload',function(req,res){ // var form = new multiparty.Form(); //设置编辑 form.encoding = 'utf-8'; //设置文件存储路径 for 阅读全文
posted @ 2017-08-27 11:12 开始战斗 阅读(357) 评论(0) 推荐(0) 编辑
摘要: 使用mysql连接池:1.安装mysql支持npm install mysql 2.安装node.js的mysqlpool模块npm install -g node-mysql //-g表全局 3.直连mysqlvar mysql = require('mysql'); //调用MySQL模块//创 阅读全文
posted @ 2017-08-27 11:11 开始战斗 阅读(372) 评论(0) 推荐(0) 编辑
摘要: var fs = require('fs'); 2 var txt = "以上程序使用fs.readFileSync从源路径读取文件内容,并使用fs.writeFileSync将文件内容写入目标路径。"; fs.writeFileSync('message.txt', 'Hello Node'); 阅读全文
posted @ 2017-08-27 11:10 开始战斗 阅读(456) 评论(0) 推荐(0) 编辑
摘要: 1.异步读取文件:var fs= require('fs'); // 从文件系统中读取请求的文件内容 fs.readFile(pathname.substr(1), function (err, data) { if (err) { console.log(err); // HTTP 状态码: 40 阅读全文
posted @ 2017-08-27 11:08 开始战斗 阅读(3625) 评论(0) 推荐(0) 编辑
摘要: 1.安装node.js(6.3.0)2.检测PATH环境变量是否配置了Node.jscmd下node --version3.D:/www/nodejs文件夹下创建hello.jsvar http = require('http'); http.createServer(function (reque 阅读全文
posted @ 2017-08-27 11:04 开始战斗 阅读(247) 评论(0) 推荐(0) 编辑
摘要: 常用命令:1.查看目录:ls ls -a 包含隐藏目录 ls -l 显示详细信息,-开头为文件 d开头为目录 蓝色为目录 绿色为可执行文件 黑色(白色):普通文件2.看帮助: man 命令名 q 退出3.看当前目录: pwd 看在哪个目录下4.进入目录 cd 目录名 绝对目录 / 相对目录 .当前目 阅读全文
posted @ 2017-08-27 10:55 开始战斗 阅读(298) 评论(0) 推荐(0) 编辑