diff --git a/service/Application/Api/Controller/AlipayLifeController.class.php b/service/Application/Api/Controller/AlipayLifeController.class.php index afaada7df..05688d20b 100644 --- a/service/Application/Api/Controller/AlipayLifeController.class.php +++ b/service/Application/Api/Controller/AlipayLifeController.class.php @@ -34,20 +34,15 @@ class AlipayLifeController extends CommonController */ public function Index() { - - - // 参数 $params = $_POST; - $obj = new \Library\AlipayLife($params); if(empty($params['service'])) { die('service error'); } // 类库 - //$obj = new \Library\AlipayLife($params); - + $obj = new \Library\AlipayLife($params); // 根据方法处理 switch($params['service']) @@ -67,6 +62,5 @@ class AlipayLifeController extends CommonController exit('service error'); } } - } ?> \ No newline at end of file diff --git a/service/Application/Library/AlipayLife.class.php b/service/Application/Library/AlipayLife.class.php index a4803cc06..9aed6e3d5 100644 --- a/service/Application/Library/AlipayLife.class.php +++ b/service/Application/Library/AlipayLife.class.php @@ -34,9 +34,7 @@ class AlipayLife public function __construct($params = []) { $this->params = $params; - $this->xml_data = isset($params['biz_content']) ? $this->xmlToArray($params['biz_content']) : ''; - - //$this->xml_data = json_decode(json_encode((array) simplexml_load_string($params['biz_content'])), true); + $this->xml_data = isset($params['biz_content']) ? $this->XmlToArray($params['biz_content']) : ''; file_put_contents('./pppppp.php', "xml_data, true).";\n\r?>"); $this->life_data = isset($this->xml_data['AppId']) ? AlipayLifeService::AppidLifeRow(['appid'=>$this->xml_data['AppId']]) : ''; @@ -126,16 +124,12 @@ class AlipayLife * @param [string] $xmltext [xml数据] * @return [array] [属组] */ - public function xmlToArray($xmltext) + public function XmlToArray($xmltext) { $xmltext = iconv("GBK", "UTF-8", urldecode($xmltext)); - $objectxml = simplexml_load_string($xmltext,'SimpleXMLElement', LIBXML_NOCDATA); + $objectxml = simplexml_load_string($xmltext, 'SimpleXMLElement', LIBXML_NOCDATA); $xmljson = json_encode($objectxml); - return json_decode($xmljson,true); - - - // libxml_disable_entity_loader(true); - // return json_decode(json_encode(simplexml_load_string($xmltext, 'SimpleXMLElement', LIBXML_NOCDATA)), true); + return json_decode($xmljson, true); } /**