通过Web服务检索数据

时间:2019-03-31 05:28:58

标签: php web-services prestashop

我使用外部prestashop Web服务检索产品 示例我如何才能恢复此标题的数量等...

$productResources = $webService->get(array('resource' => 'products','active' => '0', 'id' => (int)$product_id));
$productWB = $productResources->product;
echo $productWB->name->language; 

result = "{"@attributes":{"id":"2"},"0":"Pantalon de costume - Bleu-Ile de Paques"}"

1 个答案:

答案 0 :(得分:1)

这有效:

$productResources = $webService->get(array('resource' => 'products','active' => '0', 'id' => (int)$product_id));
$productWB = $productResources->product;
$productb = get_object_vars(json_decode($productWB->name->language));

echo $productb[0];