SetProduct_id($productId); $values = WxpayApi::bizpayurl($biz); $url = "weixin://wxpay/bizpayurl?" . $this->ToUrlParams($values); return $url; } /** * * 参数数组转换为url参数 * @param array $urlObj */ private function ToUrlParams($urlObj) { $buff = ""; foreach ($urlObj as $k => $v) { $buff .= $k . "=" . $v . "&"; } $buff = trim($buff, "&"); return $buff; } /** * 生成直接支付url,支付url有效期为2小时,模式二 * @param WxPayUnifiedOrder $input * @param array $wechatInfo * @return array * @throws WxPayException */ public function GetPayUrl($input, $wechatInfo) { if($input->GetTrade_type() == "NATIVE") { $result = WxPayApi::unifiedOrder($input, 6, $wechatInfo); return $result; } } }