上一页 1 ··· 18 19 20 21 22 23 24 25 26 ··· 68 下一页
右击菜单栏,选择“快速编辑模式”复制:选择文本后按回车,然后就可以去其他地方粘贴了粘贴:右击鼠标就可以粘贴内容简单到都不好意思发布出来了。。。。 Read More
posted @ 2015-11-11 18:33 tinyphp Views(326) Comments(0) Diggs(0) Edit
express获取参数有三种方法:req.query适合 http://localhost:3000/form?num=8888req.body 适合http://localhost:3000/form,然后Post一个num为tinyphpreq.params适合获取form后的num:http:... Read More
posted @ 2015-11-09 18:44 tinyphp Views(5029) Comments(0) Diggs(1) Edit
nodejs// 访问http://localhost:3000/home?id=001&name=tomvar http = require('http');var url = require('url');http.createServer(function(req, res) { var... Read More
posted @ 2015-11-07 21:46 tinyphp Views(395) Comments(0) Diggs(0) Edit
如果在nodejs下npm install moment引用模块:var moment = require('moment');用法:当前时间:2015-11-07 18:00:51moment().format('YYYY-MM-DD HH:mm:ss');今天是星期几:6moment().for... Read More
posted @ 2015-11-07 18:10 tinyphp Views(719) Comments(0) Diggs(0) Edit
...//index pagevar items=[{title:"文章1"},{title:"文章2"}];app.get('/',function(req,res){ res.render('index',{title:'电影首页',items:items});});...对应ejsmy ej... Read More
posted @ 2015-11-06 11:34 tinyphp Views(9983) Comments(0) Diggs(0) Edit
原app.jsvar express = require('express');var app = express(); /*start*/app.get('/',function(req,res){ res.send('home');});app.get('/admin',function(... Read More
posted @ 2015-11-05 17:11 tinyphp Views(950) Comments(0) Diggs(0) Edit
var express = require('express');var app = express(); app.get('/',function(req,res){res.redirect('/admin');});app.get('/admin',function(req,res){ r... Read More
posted @ 2015-11-05 16:36 tinyphp Views(606) Comments(0) Diggs(0) Edit
Express里有个中间件(middleware)的概念。所谓中间件,即在数据正式发给用户之前,对数据进行处理。function (req, res, next)第一个参数是Request对象req。第二个参数是Response对象res。第三个则是用来驱动中间件调用链的函数next,如果你想让后面... Read More
posted @ 2015-11-05 15:51 tinyphp Views(315) Comments(0) Diggs(0) Edit
使用 app.route() 创建路由路径的链式路由句柄。由于路径在一个地方指定,这样做有助于创建模块化的路由,而且减少了代码冗余和拼写错误。先放小实例:app.jsvar express = require('express');var app = express(); var bird =req... Read More
posted @ 2015-11-05 14:47 tinyphp Views(1407) Comments(0) Diggs(0) Edit
“路由”(routing):用于指定不同的访问路径所对应的回调函数,再简单点说就是返回结果和导航的作用。 路由结构: 最直接的路由配置方法,就是调用app.get()、app.post(); 命令:npm start 这里给网站添加了一条路由,get参数一是路径,参数二是回调函数,当用户访问网站根目 Read More
posted @ 2015-11-05 13:11 tinyphp Views(672) Comments(0) Diggs(0) Edit
上一页 1 ··· 18 19 20 21 22 23 24 25 26 ··· 68 下一页