Example #1
0
 /**
 * 直接将数组转化为xml
 * @param array $data	需要被转的数组
 * @param string $root 数组的根标签
 * @param bool $return_header 要不要含声明一起返回
 * @return
 */
 public static function toXml($data, $root = 'xml', $return_header = FALSE)
 {
     $xml = new SimpleXMLExtended("<?xml version='1.0' encoding='utf-8'?><{$root} />");
     Arr2xml::node($data, $xml);
     $xmlstr = $xml->asXML();
     $xmlstr = preg_replace('@<\\?.*?>@', '', $xmlstr);
     return trim($xmlstr);
 }
Example #2
0
 public static function crypt_xml($encrypt, $signature, $timestamp, $nonce)
 {
     $data = array('Encrypt' => $encrypt, 'MsgSignature' => $signature, 'TimeStamp' => $timestamp, 'Nonce' => $nonce);
     return Arr2xml::toXml($data);
 }