node.js 请求地址的方式如下: var https = require('https'); var addr = 'https://api.weixin.qq.com/sns/jscode2session?appid=APPID&secret=SECRET&js_code=JSCODE&grant_type=authorization_code'; https.get(addr, function(res) { // 在这里处理响应 }); 也可以使用 https.request() 发起请求,get 方法,只能发起 GET 请求,request 方法,可以发起各种请求。
node.js 请求地址的方式如下:
也可以使用 https.request() 发起请求,get 方法,只能发起 GET 请求,request 方法,可以发起各种请求。