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


PHP xmlrpcval::serialize方法代码示例

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


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

示例1: array

<?php 
include "xmlrpc.inc";
$inAr = array("Dave" => 24, "Edd" => 45, "Joe" => 37, "Fred" => 27);
reset($inAr);
print "This is the input data:<br/><pre>";
while (list($key, $val) = each($inAr)) {
    print $key . ", " . $val . "\n";
}
print "</pre>";
// create parameters from the input array: an xmlrpc array of xmlrpc structs
$p = array();
foreach ($inAr as $key => $val) {
    $p[] = new xmlrpcval(array("name" => new xmlrpcval($key), "age" => new xmlrpcval($val, "int")), "struct");
}
$v = new xmlrpcval($p, "array");
print "Encoded into xmlrpc format it looks like this: <pre>\n" . htmlentities($v->serialize()) . "</pre>\n";
// create client and message objects
$f = new xmlrpcmsg('examples.sortByAge', array($v));
$c = new xmlrpc_client("/server.php", "phpxmlrpc.sourceforge.net", 80);
// set maximum debug level, to have the complete communication printed to screen
$c->setDebug(2);
// send request
print "Now sending request (detailed debug info follows)";
$r =& $c->send($f);
// check response for errors, and take appropriate action
if (!$r->faultCode()) {
    print "The server gave me these results:<pre>";
    $v = $r->value();
    $max = $v->arraysize();
    for ($i = 0; $i < $max; $i++) {
        $rec = $v->arraymem($i);
开发者ID:5haman,项目名称:knowledgetree,代码行数:31,代码来源:agesort.php

示例2: xmlrpcmsg

<?php 
include "xmlrpc.inc";
$f = new xmlrpcmsg('examples.getStateName');
print "<h3>Testing value serialization</h3>\n";
$v = new xmlrpcval(23, "int");
print "<PRE>" . htmlentities($v->serialize()) . "</PRE>";
$v = new xmlrpcval("What are you saying? >> << &&");
print "<PRE>" . htmlentities($v->serialize()) . "</PRE>";
$v = new xmlrpcval(array(new xmlrpcval("ABCDEFHIJ"), new xmlrpcval(1234, 'int'), new xmlrpcval(1, 'boolean')), "array");
print "<PRE>" . htmlentities($v->serialize()) . "</PRE>";
$v = new xmlrpcval(array("thearray" => new xmlrpcval(array(new xmlrpcval("ABCDEFHIJ"), new xmlrpcval(1234, 'int'), new xmlrpcval(1, 'boolean'), new xmlrpcval(0, 'boolean'), new xmlrpcval(true, 'boolean'), new xmlrpcval(false, 'boolean')), "array"), "theint" => new xmlrpcval(23, 'int'), "thestring" => new xmlrpcval("foobarwhizz"), "thestruct" => new xmlrpcval(array("one" => new xmlrpcval(1, 'int'), "two" => new xmlrpcval(2, 'int')), "struct")), "struct");
print "<PRE>" . htmlentities($v->serialize()) . "</PRE>";
$w = new xmlrpcval(array($v, new xmlrpcval("That was the struct!")), "array");
print "<PRE>" . htmlentities($w->serialize()) . "</PRE>";
$w = new xmlrpcval("Mary had a little lamb,\nWhose fleece was white as snow,\nAnd everywhere that Mary went\nthe lamb was sure to go.\n\nMary had a little lamb\nShe tied it to a pylon\nTen thousand volts went down its back\nAnd turned it into nylon", "base64");
print "<PRE>" . htmlentities($w->serialize()) . "</PRE>";
print "<PRE>Value of base64 string is: '" . $w->scalarval() . "'</PRE>";
$f->method('');
$f->addParam(new xmlrpcval("41", "int"));
print "<h3>Testing request serialization</h3>\n";
$op = $f->serialize();
print "<PRE>" . htmlentities($op) . "</PRE>";
print "<h3>Testing ISO date format</h3><pre>\n";
$t = time();
$date = iso8601_encode($t);
print "Now is {$t} --> {$date}\n";
print "Or in UTC, that is " . iso8601_encode($t, 1) . "\n";
$tb = iso8601_decode($date);
print "That is to say {$date} --> {$tb}\n";
print "Which comes out at " . iso8601_encode($tb) . "\n";
print "Which was the time in UTC at " . iso8601_decode($date, 1) . "\n";
开发者ID:5haman,项目名称:knowledgetree,代码行数:31,代码来源:vardemo.php

示例3: testStringInt

 function testStringInt()
 {
     $v = new xmlrpcval('hello world', 'int');
     $s = $v->serialize();
     $this->assertequals("<value><int>0</int></value>\n", $s);
 }
开发者ID:RiquelmyMelara,项目名称:Awakened-Millionaire,代码行数:6,代码来源:testsuite.php

示例4: xmlrpcval

            $values[] = new xmlrpcval($val[0], 'int');
            $values[] = new xmlrpcval($val[1], 'double');
            $values[] = new xmlrpcval($val[2], 'string');
            $values[] = new xmlrpcval($val[3], 'boolean');
            $values[] = new xmlrpcval($val[4], 'dateTime.iso8601');
            $values[] = new xmlrpcval($val[5], 'int');
            $values[] = new xmlrpcval($val[6], 'double');
            $values[] = new xmlrpcval($val[7], 'string');
            $values[] = new xmlrpcval($val[8], 'boolean');
            $values[] = new xmlrpcval($val[9], 'dateTime.iso8601');
            $valarray[$key] = new xmlrpcval($values, 'array');
        }
        $vals[] = new xmlrpcval($valarray, 'struct');
    }
    $value = new xmlrpcval($vals, 'array');
    $out = $value->serialize();
}
end_test('Data encoding (large array)', 'manual encoding', $out);
begin_test('Data encoding (large array)', 'automatic encoding');
for ($i = 0; $i < $num_tests; $i++) {
    $value = php_xmlrpc_encode($data, array('auto_dates'));
    $out = $value->serialize();
}
end_test('Data encoding (large array)', 'automatic encoding', $out);
if (function_exists('xmlrpc_set_type')) {
    begin_test('Data encoding (large array)', 'xmlrpc-epi encoding');
    for ($i = 0; $i < $num_tests; $i++) {
        for ($j = 0; $j < 10; $j++) {
            foreach ($keys as $k) {
                xmlrpc_set_type($data[$j][$k][4], 'datetime');
                xmlrpc_set_type($data[$j][$k][8], 'datetime');
开发者ID:ronaldodia,项目名称:backend_al,代码行数:31,代码来源:benchmark.php

示例5: testDateTime

 public function testDateTime()
 {
     $time = time();
     $t1 = new xmlrpcval($time, 'dateTime.iso8601');
     $t2 = new xmlrpcval(iso8601_encode($time), 'dateTime.iso8601');
     $this->assertEquals($t1->serialize(), $t2->serialize());
     if (class_exists('DateTime')) {
         $datetime = new DateTime();
         // skip this test for php 5.2. It is a bit harder there to build a DateTime from unix timestamp with proper TZ info
         if (is_callable(array($datetime, 'setTimestamp'))) {
             $t3 = new xmlrpcval($datetime->setTimestamp($time), 'dateTime.iso8601');
             $this->assertEquals($t1->serialize(), $t3->serialize());
         }
     }
 }
开发者ID:TsobuEnterprise,项目名称:phpxmlrpc,代码行数:15,代码来源:3LocalhostTest.php

示例6: TestLocale

 function TestLocale()
 {
     $locale = setlocale(LC_NUMERIC, 0);
     /// @todo on php 5.3/win setting locale to german does not seem to set decimal separator to comma...
     if (setlocale(LC_NUMERIC, 'deu', 'de_DE@euro', 'de_DE', 'de', 'ge') !== false) {
         $v = new xmlrpcval(1.1, 'double');
         if (strpos($v->scalarval(), ',') == 1) {
             $r = $v->serialize();
             $this->assertequals(false, strpos($r, ','));
         }
         setlocale(LC_NUMERIC, $locale);
     }
 }
开发者ID:hoangsoft90,项目名称:hw-hoangweb-plugin,代码行数:13,代码来源:testsuite.php

示例7: TestLocale

 function TestLocale()
 {
     $locale = setlocale(LC_NUMERIC, 0);
     if (setlocale(LC_NUMERIC, 'deu', 'de_DE@euro', 'de_DE', 'de', 'ge') !== false) {
         $v = new xmlrpcval(1.1, 'double');
         $r = $v->serialize();
         $this->assertequals(false, strpos($r, ','));
         $this->assertequals(1, strpos($v->scalarval(), ','));
         setlocale(LC_NUMERIC, $locale);
     }
 }
开发者ID:TravisSperry,项目名称:mpa_website,代码行数:11,代码来源:testsuite.php


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