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


PHP xmlrpcval::addScalar方法代码示例

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


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

示例1: xmlrpc_encode

function xmlrpc_encode($php_val)
{
    global $xmlrpcInt;
    global $xmlrpcDouble;
    global $xmlrpcString;
    global $xmlrpcArray;
    global $xmlrpcStruct;
    global $xmlrpcBoolean;
    $type = gettype($php_val);
    $xmlrpc_val = new xmlrpcval();
    switch ($type) {
        case "array":
        case "object":
            $arr = array();
            while (list($k, $v) = each($php_val)) {
                $arr[$k] = xmlrpc_encode($v);
            }
            $xmlrpc_val->addStruct($arr);
            break;
        case "integer":
            $xmlrpc_val->addScalar($php_val, $xmlrpcInt);
            break;
        case "double":
            $xmlrpc_val->addScalar($php_val, $xmlrpcDouble);
            break;
        case "string":
            $xmlrpc_val->addScalar($php_val, $xmlrpcString);
            break;
            // <G_Giunta_2001-02-29>
            // Add support for encoding/decoding of booleans, since they are supported in PHP
        // <G_Giunta_2001-02-29>
        // Add support for encoding/decoding of booleans, since they are supported in PHP
        case "boolean":
            $xmlrpc_val->addScalar($php_val, $xmlrpcBoolean);
            break;
            // </G_Giunta_2001-02-29>
        // </G_Giunta_2001-02-29>
        case "unknown type":
        default:
            // giancarlo pinerolo <ping@alt.it>
            // it has to return
            // an empty object in case (which is already
            // at this point), not a boolean.
            break;
    }
    return $xmlrpc_val;
}
开发者ID:n0nick,项目名称:n0where,代码行数:47,代码来源:coding.php

示例2: bitflipper

function bitflipper($m)
{
    global $xmlrpcArray;
    $v = $m->getParam(0);
    $sz = $v->arraysize();
    $rv = new xmlrpcval(array(), $xmlrpcArray);
    for ($j = 0; $j < $sz; $j++) {
        $b = $v->arraymem($j);
        if ($b->scalarval()) {
            $rv->addScalar(false, "boolean");
        } else {
            $rv->addScalar(true, "boolean");
        }
    }
    return new xmlrpcresp($rv);
}
开发者ID:rahulsiwal,项目名称:younity,代码行数:16,代码来源:server.php

示例3: processResult

function processResult($result)
{
    $ret = new xmlrpcval();
    if (is_object($result)) {
        $result = get_object_vars($result);
    }
    if (is_associative_array($result)) {
        $ar = array();
        $keys = array_keys($result);
        foreach ($keys as $k) {
            $tmp = new xmlrpcval(array($k => new xmlrpcval($result[$k])), 'struct');
            $ar[] = $tmp;
        }
        $ret->addArray($ar);
    } else {
        if (is_array($result)) {
            foreach ($result as $key => $value) {
                if (!is_string($value)) {
                    $tmp = processResult($value);
                } else {
                    $tmp = new xmlrpcval();
                    $tmp->addScalar($value);
                }
                $result[$key] = $tmp;
            }
            $ret->addArray($result);
        } else {
            if (is_bool($result)) {
                $ret->addScalar($result, "boolean");
            } else {
                $ret->addScalar($result);
            }
        }
    }
    return $ret;
}
开发者ID:n2i,项目名称:xvnkb,代码行数:36,代码来源:mantisserver.php


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