mirror of
https://gitee.com/zongzhige/shopxo.git
synced 2024-12-03 04:19:37 +08:00
debug
This commit is contained in:
parent
187f50fb9e
commit
e09690d16b
@ -34,7 +34,7 @@ class AlipayLife
|
||||
public function __construct($params = [])
|
||||
{
|
||||
$this->params = $params;
|
||||
$this->xml_data = isset($params['biz_content']) ? $this->xmlToArraywww($params['biz_content']) : '';
|
||||
$this->xml_data = isset($params['biz_content']) ? $this->parseXml($params['biz_content']) : '';
|
||||
|
||||
//$this->xml_data = json_decode(json_encode((array) simplexml_load_string($params['biz_content'])), true);
|
||||
file_put_contents('./pppppp.php', "<?php\n\rreturn ".var_export($this->xml_data, true).";\n\r?>");
|
||||
@ -47,6 +47,26 @@ class AlipayLife
|
||||
}
|
||||
}
|
||||
|
||||
public function parseXml($xmls)
|
||||
{
|
||||
$array = [];
|
||||
|
||||
foreach ($xmls as $key => $xml) {
|
||||
/** @var SimpleXMLElement $xml */
|
||||
$count = $xml->count();
|
||||
|
||||
if ($count == 0) {
|
||||
$res = (string) $xml;
|
||||
} else {
|
||||
$res = $this->parseXml($xml);
|
||||
}
|
||||
|
||||
$array[$key] = $res;
|
||||
}
|
||||
|
||||
return $array;
|
||||
}
|
||||
|
||||
public function xmlToArraywww($xml){
|
||||
//考虑到xml文档中可能会包含<![CDATA[]]>标签,第三个参数设置为LIBXML_NOCDATA
|
||||
if (file_exists($xml)) {
|
||||
|
Loading…
Reference in New Issue
Block a user