/** * 将xml转为array * @param string $xml * @param string $mchKey 商户Api密钥 * @throws WxPayException */ public static function init($xml, $mchKey = '') { $obj = new self(); if ($mchKey) { $obj->setMchKey($mchKey); } $obj->fromXml($xml); //fix bug 2015-06-29 if ($obj->values['return_code'] != 'SUCCESS') { return $obj->getValues(); } $obj->checkSign(); return $obj->getValues(); }