Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/blackberry/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php 将WSDL转换为数组_Php_Arrays_Wsdl_Soap Client - Fatal编程技术网

Php 将WSDL转换为数组

Php 将WSDL转换为数组,php,arrays,wsdl,soap-client,Php,Arrays,Wsdl,Soap Client,我有一个映射到变量的WSDL $client = new SoapClient($wsdl, array("connection_timeout"=>10)); <pre> foreach ($product as $products) { $currentStockQuantity = $product->barCode($products); echo $currentStockQuantity; echo $products->bar

我有一个映射到变量的WSDL

$client = new SoapClient($wsdl, array("connection_timeout"=>10));
<pre>
foreach ($product as $products) {
    $currentStockQuantity = $product->barCode($products);
    echo $currentStockQuantity;
    echo $products->barCode;
    echo $products[$i]->shortDescription;
    echo $products[$i]->barCode;
    $i++;
}
它返回如下数组:

stdClass Object
(
[getProductsReturn] => Array
    (
        [0] => stdClass Object
            (
                [barCode] => 5060285475448
                [brandId] => 0
                [childProductIds] => stdClass Object
                    (
                    )

                [childProductIdsAsIntArray] => stdClass Object
                    (
                    )

                [childProductIdsList] => 
                [fullProductPaths] => Candles->Amber And Lavender Scented Sachet
                [fullProductPathsArray] => stdClass Object
                    (
                    )

                [id] => 5883
                [image] => 
                [imageId] => 0
                [itemCount] => 1
                [longDescription] => 
                [masterProductId] => 5883
                [message] => 
                [messagePrice] => 0
                [messageType] => 0
                [optionId] => 0
                [optionName] => null
                [optionSetId] => 0
                [optionSetName] => null
                [orderType] => 5050
                [parentProductCode] => 
                [parentProductId] => 8088
                [price] => 2.99
                [productCode] => AA2485
                [productId] => 0
                [productType] => 1010
                [quantity] => 0
                [quantityPrice] => 0
                [rrp] => 2.99
                [shortDescription] => Amber And Lavender Scented Sachet
                [variation] => 
                [vatCodeDomainId] => 0
                [wrappingPrice] => 0
                [wrappingType] => 0
            )

        [1] => stdClass Object
            (
                [barCode] => 5060285475547
                [brandId] => 0
                [childProductIds] => stdClass Object
                    (
                    )

                [childProductIdsAsIntArray] => stdClass Object
                    (
                    )

                [childProductIdsList] => 
                [fullProductPaths] => Candles->Lavender And Bergamot Scented Sachet
                [fullProductPathsArray] => stdClass Object
                    (
                    )

                [id] => 5881
                [image] => 
                [imageId] => 0
                [itemCount] => 1
                [longDescription] => 
                [masterProductId] => 5881
                [message] => 
                [messagePrice] => 0
                [messageType] => 0
                [optionId] => 0
                [optionName] => null
                [optionSetId] => 0
                [optionSetName] => null
                [orderType] => 5050
                [parentProductCode] => 
                [parentProductId] => 8088
                [price] => 2.99
                [productCode] => AA2484
                [productId] => 0
                [productType] => 1010
                [quantity] => 0
                [quantityPrice] => 0
                [rrp] => 2.99
                [shortDescription] => Lavender And Bergamot Scented Sachet
                [variation] => 
                [vatCodeDomainId] => 0
                [wrappingPrice] => 0
                [wrappingType] => 0
            )
我想在HTML中显示这一点,这是我在for循环中给出的:


foreach($product as$products){
$currentStockQuantity=$product->条形码($products);
echo$currentStockQuantity;
echo$产品->条形码;
echo$产品[$i]->简短描述;
echo$产品[$i]->条形码;
$i++;
}

但它并没有显示所有的产品,大约有100个产品,但目前只有一个显示

假设您将WSDL中的结果数组存储在
$products
变量中,您可以尝试:


关于foreach的更多信息:

假设您将WSDL中的结果数组存储在
$products
变量中,您可以尝试:


有关foreach的更多信息:

在您发布的代码中,我们无法看到您使用的for循环,因此此时无法找到错误。只要它显示第一个元素,显示数据的概念就可以了,但问题似乎出在循环中。请根据发布代码,以便我们可以重现错误。在您发布的代码中,我们无法看到您使用的for循环,因此此时无法找到错误。只要它显示第一个元素,显示数据的概念就可以了,但问题似乎出在循环中。请根据发布代码,以便我们重现错误。
foreach ($products as $product) {
    echo $product->shortDescription;
    echo $product->barCode;
    // ... and whatever you want
}