feat/task1-c-wallet
gongfuxiang 2018-10-23 02:16:22 +08:00
parent d56a524261
commit aa9c6f3621
2 changed files with 5 additions and 17 deletions

View File

@ -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');
}
}
}
?>

View File

@ -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', "<?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']]) : '';
@ -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);
}
/**