$value){ echo "$key : ".htmlspecialchars($value, ENT_QUOTES)."
"; } } function unifiedorder(){ try{ $tools = new JsApiPay(); $openId = $tools->GetOpenid(); //②、统一下单 $input = new WxPayUnifiedOrder(); $input->SetBody("test"); $input->SetAttach("test"); $input->SetOut_trade_no("sdkphp".date("YmdHis")); $input->SetTotal_fee("1"); $input->SetTime_start(date("YmdHis")); $input->SetTime_expire(date("YmdHis", time() + 600)); $input->SetGoods_tag("test"); $input->SetNotify_url('http://'.$_SERVER['HTTP_HOST']."/index.php/Api/wxjsapi/notify"); $input->SetTrade_type("JSAPI"); $input->SetOpenid($openId); $config = new WxPayConfig(); $order = WxPayApi::unifiedOrder($config, $input); //echo '统一下单支付单信息
'; $this->printf_info($order); $PayConf['jsApiParameters'] = $tools->GetJsApiParameters($order); //获取共享收货地址js函数参数 $PayConf['editAddress'] = $tools->GetEditAddressParameters(); return $PayConf; } catch(Exception $e) { Log::ERROR(json_encode($e)); } return false; } } ?>