当前位置: 首页>>代码示例>>PHP>>正文


PHP XML::compose方法代码示例

本文整理汇总了PHP中XML::compose方法的典型用法代码示例。如果您正苦于以下问题:PHP XML::compose方法的具体用法?PHP XML::compose怎么用?PHP XML::compose使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在XML的用法示例。


在下文中一共展示了XML::compose方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: testSerialization

 function testSerialization()
 {
     $input = array(array('Project' => array('id' => 1, 'title' => null, 'client_id' => 1, 'show' => 1, 'is_spotlight' => null, 'style_id' => 0, 'job_type_id' => 1, 'industry_id' => 1, 'modified' => null, 'created' => null), 'Style' => array('id' => null, 'name' => null), 'JobType' => array('id' => 1, 'name' => 'Touch Screen Kiosk'), 'Industry' => array('id' => 1, 'name' => 'Financial')), array('Project' => array('id' => 2, 'title' => null, 'client_id' => 2, 'show' => 1, 'is_spotlight' => null, 'style_id' => 0, 'job_type_id' => 2, 'industry_id' => 2, 'modified' => '2007-11-26 14:48:36', 'created' => null), 'Style' => array('id' => null, 'name' => null), 'JobType' => array('id' => 2, 'name' => 'Awareness Campaign'), 'Industry' => array('id' => 2, 'name' => 'Education')));
     $expected = '<project id="1" title="" client_id="1" show="1" is_spotlight="" style_id="0" job_type_id="1" industry_id="1" modified="" created=""><style id="" name="" /><job_type id="1" name="Touch Screen Kiosk" /><industry id="1" name="Financial" /></project><project id="2" title="" client_id="2" show="1" is_spotlight="" style_id="0" job_type_id="2" industry_id="2" modified="2007-11-26 14:48:36" created=""><style id="" name="" /><job_type id="2" name="Awareness Campaign" /><industry id="2" name="Education" /></project>';
     $xml = new XML($input);
     $result = $xml->compose(false);
     $result = preg_replace("/\n/", '', $result);
     $this->assertEqual($expected, $result);
 }
开发者ID:kaz0636,项目名称:openflp,代码行数:9,代码来源:xml.test.php

示例2: serialize

 /**
  * Serializes a model resultset into XML
  *
  * @param  mixed  $data The content to be converted to XML
  * @param  array  $options The data formatting options
  * @return string A copy of $data in XML format
  */
 function serialize($data, $options = array())
 {
     if (!class_exists('XML') && !class_exists('xml')) {
         uses('xml');
     }
     $options = array_merge(array('attributes' => false, 'format' => 'xml'), $options);
     switch ($options['format']) {
         case 'xml':
             break;
         case 'attributes':
             break;
     }
     $data = new XML($data);
     return $data->compose(false);
 }
开发者ID:kaz0636,项目名称:openflp,代码行数:22,代码来源:xml.php


注:本文中的XML::compose方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。