略微加速

PHP官方手册 - 互联网笔记

PHP - Manual: SoapClient::__getTypes

2024-11-14

SoapClient::__getTypes

(PHP 5, PHP 7, PHP 8)

SoapClient::__getTypesReturns a list of SOAP types

说明

public SoapClient::__getTypes(): ?array

Returns an array of types described in the WSDL for the Web service.

注意:

此函数仅在 WSDL 模式下生效。

参数

此函数没有参数。

返回值

The array of SOAP types, detailing all structures and types.

范例

示例 #1 SoapClient::__getTypes() example

<?php
$client 
= new SoapClient('http://soap.amazon.com/schemas3/AmazonWebServices.wsdl');
var_dump($client->__getTypes());
?>

以上例程会输出:

array(88) {
  [0]=>
  string(30) "ProductLine ProductLineArray[]"
  [1]=>
  string(85) "struct ProductLine {
 string Mode;
 string RelevanceRank;
 ProductInfo ProductInfo;
}"
  [2]=>
  string(105) "struct ProductInfo {
 string TotalResults;
 string TotalPages;
 string ListName;
 DetailsArray Details;
}"
...
  [85]=>
  string(32) "ShortSummary ShortSummaryArray[]"
  [86]=>
  string(121) "struct GetTransactionDetailsRequest {
 string tag;
 string devtag;
 string key;
 OrderIdArray OrderIds;
 string locale;
}"
  [87]=>
  string(75) "struct GetTransactionDetailsResponse {
 ShortSummaryArray ShortSummaries;
}"
}

参见

add a noteadd a note

User Contributed Notes 1 note

up
21
felipe dot cwb at hotmail dot com
7 years ago
<?php
// to see formated types

$soap = new SoapClient('http://domain.com/ws.php?WSDL');

echo
'<pre>';
echo
'<h2>Types:</h2>';
$types = $soap->__getTypes();
foreach (
$types as $type) {
   
$type = preg_replace(
        array(
'/(\w+) ([a-zA-Z0-9]+)/', '/\n /'),
        array(
'<font color="green">${1}</font> <font color="blue">${2}</font>', "\n\t"),
       
$type
   
);
    echo
$type;
    echo
"\n\n";
}
echo
'</pre>';

官方地址:https://www.php.net/manual/en/soapclient.gettypes.php

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