code: protected function toXml($data)
      {
          if (!is_array($data) || count($data) <= 0) {
              throw new InvalidArgumentException('convert to xml error !invalid array!');
          }
          $xml = '<xml>';
          foreach ($data as $key => $val) {
              $xml .= (is_numeric($val) ? "<{$key}>{$val}</{$key}>" : "<{$key}><![CDATA[{$val}]]></{$key}>");
          }
          return $xml . '</xml>';
      }
docs: 转为XML数据
  @param array $data 源数据
  @return string