刚看了微信支付v3服务商php版文档,要求必须在请求中添加header,但是没有看懂如何在请求中添加header??
示例如下:
$resp = $instance
->chain('v3/pay/transactions/native')
->post(['json' => [
'mchid' => '1900006XXX',
'out_trade_no' => 'native12177525012014070332333',
'appid' => 'wxdace645e0bc2cXXX',
'description' => 'Image形象店-深圳腾大-QQ公仔',
'notify_url' => 'https://weixin.qq.com/',
'amount' => [
'total' => 1,
'currency' => 'CNY'
],
]]);
如何添加header呢,是直接添加到post中吗,请懂给说下。
你看下这个实例【关于微信支付小程序v3【附PHP完整后端代码】】,不知是否符合你的需求,链接:https://jiuaidu.com/jianzhan/919029/
header('Content-type:text/html; Charset=utf-8');
ini_set('date.timezone','Asia/Shanghai');
$data_s = file_get_contents('php://input');
$data_s = json_decode($data_s,true);
if(empty($data_s['out_trade_no'])){
exit;
}