贴上微信小程序发送http请求代码:
[javascript] view plain copy
onsend: function(){
wx.request({
url: ':1000', //c++后台ip、端口
data: {
x: '1' , //发送到后台字段
y: '2'
},
header:{
"Content-Type":"application/json"
},
method:"POST", //发送POST,若为GET则改为GET
[javascript] view plain copy
success: function(res) {
var data = res.data;
console.log(data);
}
});
}
官网地址:
修改代码:
1、request_parser.hpp:
[cpp] view plain copy
//
// request_parser.hpp
// ~~~~~~~~~~~~~~~~~~
//
// Copyright (c) 2003-2008 Christopher M. Kohlhoff (chris at kohlhoff dot com)
//
// Distributed under the Boost Software License, Version 1.0. (See accompanying
// file LICENSE_1_0.txt or copy at )
//
#ifndef HTTP_SERVER3_REQUEST_PARSER_HPP
#define HTTP_SERVER3_REQUEST_PARSER_HPP
#include <boost/logic/tribool.hpp>
#include <boost/tuple/tuple.hpp>
namespace http {
namespace server3 {
struct request;
/// Parser for incoming requests.
class request_parser
{
public:
/// Construct ready to parse the request method.
request_parser();
/// Reset to initial parser state.
void reset();
/// Parse some data. The tribool r