首页 > 代码库 > node提交表单到mysql

node提交表单到mysql

  var http = require (‘http‘);

  var fs = require (‘fs‘);

  var qs=require(‘querystring‘);

  var hostname=‘127.0.0.1‘;

  var port=8080;

  //创建服务

  var server=http.createServer(function(req,res){

    if(req.url!==‘./favicon.ico‘){
      req.on(‘data‘,function(data){

        console.log(‘服务器接收到的数据:‘+decodeURIComponent(data));

        var param=qs.parse(decodeURIComponent(data));

        console.log(param);

      })

    } 

  })

node提交表单到mysql