From 8a38e241609b99bc0378f1a2f665045e908237d2 Mon Sep 17 00:00:00 2001 From: Anyon Date: Tue, 19 Jun 2018 10:21:32 +0800 Subject: [PATCH] =?UTF-8?q?[=E6=9B=B4=E6=96=B0]=20=E5=BE=AE=E4=BF=A1?= =?UTF-8?q?=E6=94=AF=E4=BB=98=E5=A2=9E=E5=8A=A0toXml=E6=96=B9=E6=B3=95?= =?UTF-8?q?=EF=BC=8C=E5=8F=AF=E7=94=A8=E4=BA=8E=E5=9B=9E=E5=A4=8D=E9=80=9A?= =?UTF-8?q?=E7=9F=A5=E5=A4=84=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- WeChat/Contracts/BasicPay.php | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/WeChat/Contracts/BasicPay.php b/WeChat/Contracts/BasicPay.php index 8de0a11..22118fc 100644 --- a/WeChat/Contracts/BasicPay.php +++ b/WeChat/Contracts/BasicPay.php @@ -120,6 +120,22 @@ class BasicPay return $this->callPostApi($url, ['long_url' => $longUrl]); } + + /** + * 数组直接转xml数据输出 + * @param array $data + * @param bool $isReturn + * @return string + */ + public function toXml(array $data, $isReturn = false) + { + $xml = Tools::arr2xml($data); + if ($isReturn) { + return $xml; + } + echo $xml; + } + /** * 以Post请求接口 * @param string $url 请求