略微加速

PHP官方手册 - 互联网笔记

PHP - Manual: xmlrpc_get_type

2024-04-28

xmlrpc_get_type

(PHP 4 >= 4.1.0, PHP 5, PHP 7)

xmlrpc_get_type为 PHP 的值获取 xmlrpc 的类型

说明

xmlrpc_get_type(mixed $value): string
警告

此函数是实验性的。此函数的表象,包括名称及其相关文档都可能在未来的 PHP 发布版本中未通知就被修改。使用本函数风险自担。

该函数对于 base64 与日期时间字符串特别有用。

参数

value

PHP value

返回值

Returns the XML-RPC type.

范例

示例 #1 XML-RPC type example

<?php
echo xmlrpc_get_type(null) . "\n"// base64
echo xmlrpc_get_type(false) . "\n"// boolean
echo xmlrpc_get_type(1) . "\n"// int
echo xmlrpc_get_type(1.0) . "\n"// double
echo xmlrpc_get_type("") . "\n"// string
echo xmlrpc_get_type(array()) . "\n"// array
echo xmlrpc_get_type(new stdClass) . "\n"// array
echo xmlrpc_get_type(STDIN) . "\n"// int
?>

参见

  • xmlrpc_set_type() - 为一个 PHP 字符串值设置 xmlrpc 的类型、base64 或日期时间
add a noteadd a note

User Contributed Notes 1 note

up
0
hfuecks at pinkgoblin dot com
19 years ago
This function returns the type of a PHP variable in XML-RPC terms. It won't "spot" base64 or iso8601 types unless they have been defined using xmlrpc_set_type().

For iso8601 type it returns "datetime".

Otherwise it returns strings corresponding directly the XML-RPC data types e.g. "struct","int","string","base64" etc.

官方地址:https://www.php.net/manual/en/function.xmlrpc-get-type.php

北京半月雨文化科技有限公司.版权所有 京ICP备12026184号-3