项目需求在生成xml的时候不需要头部申明 <?xml version=“1.0” encoding=“UTF-8” standalone=“yes”?> 只需要这种格式 <xml>
</xml>
var body = {xml:{ appid: settings.wechat.AppID, mch_id: settings.wechat.MCH_ID, body:'Ipad mini 16G 白色', detail: 'detail', out_trade_no: WeChatPay.getOutTradeNo(), total_fee:1, nonce_str: WeChatPay.getNonceStr(), spbill_create_ip:utils.getClientIp(req), notify_url:settings.wechat.NORTIFYURL, trade_type: 'APP', }}; body.xml.sign = WeChatPay.random(body.xml); var xml = b.buildObject(body); console.log(xml);
这段代码生成的xml老是带着头 怎么去掉
headless选项
headless (default: false): omit the XML header. Added in 0.4.3.