debug
parent
d56a524261
commit
aa9c6f3621
|
|
@ -34,20 +34,15 @@ class AlipayLifeController extends CommonController
|
||||||
*/
|
*/
|
||||||
public function Index()
|
public function Index()
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// 参数
|
// 参数
|
||||||
$params = $_POST;
|
$params = $_POST;
|
||||||
$obj = new \Library\AlipayLife($params);
|
|
||||||
if(empty($params['service']))
|
if(empty($params['service']))
|
||||||
{
|
{
|
||||||
die('service error');
|
die('service error');
|
||||||
}
|
}
|
||||||
|
|
||||||
// 类库
|
// 类库
|
||||||
//$obj = new \Library\AlipayLife($params);
|
$obj = new \Library\AlipayLife($params);
|
||||||
|
|
||||||
|
|
||||||
// 根据方法处理
|
// 根据方法处理
|
||||||
switch($params['service'])
|
switch($params['service'])
|
||||||
|
|
@ -67,6 +62,5 @@ class AlipayLifeController extends CommonController
|
||||||
exit('service error');
|
exit('service error');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
|
|
@ -34,9 +34,7 @@ class AlipayLife
|
||||||
public function __construct($params = [])
|
public function __construct($params = [])
|
||||||
{
|
{
|
||||||
$this->params = $params;
|
$this->params = $params;
|
||||||
$this->xml_data = isset($params['biz_content']) ? $this->xmlToArray($params['biz_content']) : '';
|
$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);
|
|
||||||
file_put_contents('./pppppp.php', "<?php\n\rreturn ".var_export($this->xml_data, true).";\n\r?>");
|
file_put_contents('./pppppp.php', "<?php\n\rreturn ".var_export($this->xml_data, true).";\n\r?>");
|
||||||
$this->life_data = isset($this->xml_data['AppId']) ? AlipayLifeService::AppidLifeRow(['appid'=>$this->xml_data['AppId']]) : '';
|
$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数据]
|
* @param [string] $xmltext [xml数据]
|
||||||
* @return [array] [属组]
|
* @return [array] [属组]
|
||||||
*/
|
*/
|
||||||
public function xmlToArray($xmltext)
|
public function XmlToArray($xmltext)
|
||||||
{
|
{
|
||||||
$xmltext = iconv("GBK", "UTF-8", urldecode($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);
|
$xmljson = json_encode($objectxml);
|
||||||
return json_decode($xmljson,true);
|
return json_decode($xmljson, true);
|
||||||
|
|
||||||
|
|
||||||
// libxml_disable_entity_loader(true);
|
|
||||||
// return json_decode(json_encode(simplexml_load_string($xmltext, 'SimpleXMLElement', LIBXML_NOCDATA)), true);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue