xmltoArray($str); if($str['return_code']=='SUCCESS'){ $decrypt = base64_decode($str['req_info'], true); $this->return_info=$this->xmlToArray(openssl_decrypt($decrypt , 'aes-256-ecb', MD5($key), OPENSSL_RAW_DATA)); $this->return_info['return_code']='SUCCESS'; }else{ $this->return_info=['return_code'=>'FAIL','return_msg'=>$str['return_msg']]; } } public function decryptData(){ return $this->return_info; } public function xmlToArray($xml) { libxml_disable_entity_loader(true); // 禁止引用外部xml实体 $jsonxml = json_encode(simplexml_load_string($xml, 'SimpleXMLElement', LIBXML_NOCDATA)); $result = json_decode($jsonxml, true); return $result; } }