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


PHP XML_Unserializer::unserialize方法代码示例

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


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

示例1: testFloat

 /**
  * Test unserializing a float
  */
 public function testFloat()
 {
     $u = new XML_Unserializer();
     $u->setOption(XML_UNSERIALIZER_OPTION_GUESS_TYPES, true);
     $xml = '<xml>453.54553</xml>';
     $u->unserialize($xml);
     $this->assertEquals(453.54553, $u->getUnserializedData());
     $xml = '<xml>-1.47</xml>';
     $u->unserialize($xml);
     $this->assertEquals(-1.47, $u->getUnserializedData());
 }
开发者ID:pear,项目名称:xml_serializer,代码行数:14,代码来源:Unserializer_Option_GuessTypesTest.php

示例2: read

 protected function read($filename)
 {
     $xml = file_get_contents($filename);
     $unserializer = new XML_Unserializer();
     $unserializer->unserialize($xml);
     return $unserializer->getUnserializedData();
 }
开发者ID:dracony,项目名称:forked-php-orm-benchmark,代码行数:7,代码来源:Definition.php

示例3: gmlConverter

 function __construct($gmlSource)
 {
     parent::__construct();
     include_once "libs/class_xml_check.php";
     $check = new XML_check();
     if ($check->check_string($gmlSource)) {
         print "GML is well-formed\n";
         //print("Elements      : ".$check->get_xml_elements());
         //print("Attributes    : ".$check->get_xml_attributes());
         //print("Size          : ".$check->get_xml_size());
         //print("Text sections : ".$check->get_xml_text_sections());
         //print("Text size     : ".$check->get_xml_text_size());
     } else {
         print "GML is not well-formed. ";
         print $check->get_full_error() . "\n";
         print "Script terminated\n";
         die;
     }
     $this->gmlSource = $gmlSource;
     $this->gmlCon = new gmlConverter();
     require_once "XML/Unserializer.php";
     $unserializer_options = array('parseAttributes' => TRUE);
     $unserializer = new XML_Unserializer($unserializer_options);
     // Serialize the data structure
     $status = $unserializer->unserialize($this->gmlSource);
     $this->gmlArray = $unserializer->getUnserializedData();
     print date('l jS \\of F Y h:i:s A') . " GML serialized\n";
     // Check if XML is a ServiceException
     if ($unserializer->getRootName() == "ServiceExceptionReport") {
         print "The server returned an exception:\n";
         print $this->gmlSource . "\n";
         print "Script terminated\n";
         die;
     }
 }
开发者ID:ronaldoof,项目名称:geocloud2,代码行数:35,代码来源:gmlparser.php

示例4: testRootName

 /**
  * Test extracting the root name
  */
 public function testRootName()
 {
     $u = new XML_Unserializer();
     $xml = '<xml>data</xml>';
     $u->unserialize($xml);
     $this->assertEquals('xml', $u->getRootName());
 }
开发者ID:quangbt2005,项目名称:vhost-kis,代码行数:10,代码来源:Unserializer_Scalars_TestCase.php

示例5: _loadAcronymList

function _loadAcronymList()
{
    $unser = new XML_Unserializer(array('parseAttributes' => TRUE, 'attributesArray' => '_attrs'));
    $unser->unserialize(PATH_INCLUDE . "xslt/inc/acronyms.xml", true);
    $dat = $unser->getUnserializedData();
    return $dat['word'];
}
开发者ID:BackupTheBerlios,项目名称:openweb-cms-svn,代码行数:7,代码来源:Acronyms.lib.php

示例6: fetchData

 function fetchData($username, $password)
 {
     switch ($this->options['cryptType']) {
         case 'blowfish':
             include_once 'Crypt/Blowfish.php';
             $bf = new Crypt_Blowfish($this->options['cryptKey']);
             $password = $bf->encrypt($password);
             $password = base64_encode($password);
             break;
         default:
             if (function_exists($this->options['cryptType'])) {
                 $password = $this->options['cryptType']($password);
             }
             break;
     }
     $req = new HTTP_Request();
     $req->setURL($this->options['URL']);
     $req->setMethod(HTTP_REQUEST_METHOD_GET);
     $req->addQueryString($this->options['usernameKey'], $username);
     $req->addQueryString($this->options['passwordKey'], $password);
     if (!PEAR::isError($req->sendRequest())) {
         $response = $req->getResponseBody();
     } else {
         return false;
     }
     $unserializer = new XML_Unserializer();
     if ($unserializer->unserialize($response)) {
         $this->result_value = $unserializer->getUnserializedData();
         if ($this->result_value[$this->options['resultKey']] == $this->options['correctValue']) {
             return true;
         }
     }
     return false;
 }
开发者ID:KimuraYoichi,项目名称:PukiWiki,代码行数:34,代码来源:REST_XML.php

示例7: testIndexed

 /**
  * Test unserializing an indexed array
  */
 public function testIndexed()
 {
     $u = new XML_Unserializer();
     $u->setOption(XML_UNSERIALIZER_OPTION_COMPLEXTYPE, 'array');
     $xml = '<xml><foo>bar</foo><foo>tomato</foo></xml>';
     $u->unserialize($xml);
     $this->assertEquals(array('foo' => array('bar', 'tomato')), $u->getUnserializedData());
 }
开发者ID:pear,项目名称:xml_serializer,代码行数:11,代码来源:Unserializer_ArraysTest.php

示例8: readData

 function readData()
 {
     require_once 'XML/Unserializer.php';
     $xmlEngine = new XML_Unserializer();
     if ($xmlEngine->unserialize($this->getFile())) {
         return $xmlEngine->getUnserializedData();
     }
     return false;
 }
开发者ID:radicaldesigns,项目名称:amp,代码行数:9,代码来源:XMLFields.inc.php

示例9: testUtf8ToIso

 /**
  * Test unserializing from UTF-8 to ISO-8859-1
  */
 public function testUtf8ToIso()
 {
     $u = new XML_Unserializer();
     $u->setOption(XML_UNSERIALIZER_OPTION_ENCODING_SOURCE, 'UTF-8');
     $u->setOption(XML_UNSERIALIZER_OPTION_ENCODING_TARGET, 'ISO-8859-1');
     $xml = '<xml>' . utf8_encode('A string containing ü ä Ãê') . '</xml>';
     $u->unserialize($xml);
     $this->assertEquals('A string containing ü ä Ãê', $u->getUnserializedData());
 }
开发者ID:quangbt2005,项目名称:vhost-kis,代码行数:12,代码来源:Unserializer_Option_Encodings_TestCase.php

示例10: executeIndex

 /**
  * Executes index action
  *
  * @param sfRequest $request A request object
  */
 public function executeIndex(sfWebRequest $request)
 {
     $b = new sfWebBrowser();
     $b->post(sfConfig::get('sf_takutomo_get_reserved_driver_url'), array('guid' => 'mixi,' . MixiAppMobileApi::$ownerId));
     $options = array('complexType' => 'array', 'parseAttributes' => TRUE);
     $Unserializer = new XML_Unserializer($options);
     //$Unserializer->setOption('parseAttributes', TRUE);
     $status = $Unserializer->unserialize($b->getResponseText());
     $this->list = $Unserializer->getUnserializedData();
 }
开发者ID:pontuyo,项目名称:takutomo-mixi-appli,代码行数:15,代码来源:actions.class.php

示例11: executeIndex

 /**
  * Executes index action
  *
  * @param sfRequest $request A request object
  */
 public function executeIndex(sfWebRequest $request)
 {
     $this->form = new sfForm();
     //xmlを連想配列に変換
     $options = array('complexType' => 'array');
     $b = new sfWebBrowser();
     $b->post(sfConfig::get('sf_takutomo_get_profile_url'), array('id' => $this->getRequestParameter('m_id')));
     $Unserializer = new XML_Unserializer($options);
     $status = $Unserializer->unserialize($b->getResponseText());
     $this->profile = $Unserializer->getUnserializedData();
 }
开发者ID:pontuyo,项目名称:takutomo-mixi-appli,代码行数:16,代码来源:actions.class.php

示例12: doUnpack

 /**
  * Unpack definition procedure
  *
  * @return array
  * @author Sergey Startsev
  */
 protected function doUnpack($definition)
 {
     $unserializer = new XML_Unserializer($this->unserialize_options);
     // check unserialize status
     $status = $unserializer->unserialize(trim($definition), false);
     if (!$status) {
         throw new afsXmlDefinitionException($status->getMessage());
     }
     // get unserialized data
     return $unserializer->getUnserializedData();
 }
开发者ID:cbsistem,项目名称:appflower_studio,代码行数:17,代码来源:afsXmlDefinition.class.php

示例13: testSetterMethod

 /**
  * Test unserializing with a setter method
  */
 public function testSetterMethod()
 {
     $u = new XML_Unserializer();
     $u->setOption(XML_UNSERIALIZER_OPTION_COMPLEXTYPE, 'object');
     $u->setOption(XML_UNSERIALIZER_OPTION_DEFAULT_CLASS, 'Foo');
     $xml = '<SetterExample><foo>tomato</foo></SetterExample>';
     $u->unserialize($xml);
     $result = new SetterExample();
     $result->setFoo('tomato');
     $this->assertEquals($result, $u->getUnserializedData());
 }
开发者ID:pear,项目名称:xml_serializer,代码行数:14,代码来源:Unserializer_ObjectsTest.php

示例14: executeIndex

 /**
  * Executes index action
  *
  * @param sfRequest $request A request object
  */
 public function executeIndex(sfWebRequest $request)
 {
     $b = new sfWebBrowser();
     $b->get(sfConfig::get('sf_takutomo_get_attend_event_url'), array('guid' => 'DEBUG,sample_member_001'));
     //xmlを連想配列に変換
     $options = array('complexType' => 'array');
     $Unserializer = new XML_Unserializer($options);
     $status = $Unserializer->unserialize($b->getResponseText());
     //if ($status === true) {
     $this->get_attend_event_list = $Unserializer->getUnserializedData();
 }
开发者ID:pontuyo,项目名称:takutomo-mixi-appli,代码行数:16,代码来源:actions.class.php

示例15: randomPerson

function randomPerson()
{
    $dir = 'collectedData';
    $files = glob($dir . '/*.*');
    $file = array_rand($files);
    $us = new XML_Unserializer();
    $options = array(XML_UNSERIALIZER_OPTION_TAG_MAP => array('util' => 'XML_Util'), XML_UNSERIALIZER_OPTION_ATTRIBUTE_CLASS => '_classname');
    $us->setOptions($options);
    $us->setOption(XML_UNSERIALIZER_OPTION_COMPLEXTYPE, 'object');
    $result = $us->unserialize($files[$file], true);
    return $us->_unserializedData;
}
开发者ID:sakonet,项目名称:kunstquiz,代码行数:12,代码来源:random.php


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