这两种方式得到结果一样但是为什么我的不行??

$bizcontent是支付宝官方的例子
$bizcontent2是我写的 得到的结果明明是一样的 为什么拿着我的去请求方法得到的结果就会报错?拿着$bizcontent请求就正常 这是为什么?

$bizcontent = "{\"body\":\"test\"," 
                . "\"subject\":\"test\","
                . "\"out_trade_no\":\"$timestamp\","
                . "\"timeout_express\":\"30m\"," 
                . "\"total_amount\":\"$total_amount\","
                . "\"product_code\":\"QUICK_MSECURITY_PAY\""
                . "}";
$bizcontent2=json_encode([
            'body'=> 'test',
            'subject'=> 'test',
            'out_order_no'=> strval($timestamp),
            'timeout_express'=> '30m',
            'total_amount'=> strval($total_amount),
            'product_code'=> 'QUICK_MSECURITY_PAY'
]);

结果除了时间戳 都是一模一样的

{"body":"test","subject":"test","out_trade_no":"1585214276","timeout_express":"30m","total_amount":"0.01","product_code":"QUICK_MSECURITY_PAY"}

{"body":"test","subject":"test","out_order_no":"1585214313","timeout_express":"30m","total_amount":"0.01","product_code":"QUICK_MSECURITY_PAY"}
阅读 91
评论 更新于 3月26日
    撰写回答

    登录后参与交流、获取后续更新提醒