第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號(hào)安全,請(qǐng)及時(shí)綁定郵箱和手機(jī)立即綁定
已解決430363個(gè)問(wèn)題,去搜搜看,總會(huì)有你想問(wèn)的

作為對(duì)象 std 類從 Web 服務(wù)中單獨(dú)接收

作為對(duì)象 std 類從 Web 服務(wù)中單獨(dú)接收

PHP
郎朗坤 2022-12-23 15:15:46
我從網(wǎng)絡(luò)服務(wù)中得到這個(gè)并嘗試了很多我在類似主題中找到的解決方案,但無(wú)法將它們分開(kāi)以在我的代碼中使用:stdClass Object (    [getPropsListResult] => [        {            "id":16461,            "Material":"1000001",            "SalesDescription":"product1",            "Plnt":"1339",            "PlantName":"WAREHOUSE1",            "SalesPrice":"15000"        },        {            "id":16462,            "Material":"1000001",            "SalesDescription":" product2",            "Plnt":"1018",            "PlantName":"WAREHOUSE2",            "SalesPrice":"15000"        },        {            "id":16463,            "Material":"1000002",            "SalesDescription":" product3",            "Plnt":"1339",            "PlantName":"WAREHOUSE1",            "SalesPrice":"22000"        },        {            "id":32920,            "Material":"1072941",            "SalesDescription":"product4",            "Plnt":"1018",            "PlantName":" WAREHOUSE1",            "SalesPrice":"0"        }    ])請(qǐng)幫助我如何使用這些信息?
查看完整描述

2 回答

?
喵喔喔

TA貢獻(xiàn)1735條經(jīng)驗(yàn) 獲得超5個(gè)贊

您從 Web 服務(wù)收到的響應(yīng)具有json encoded負(fù)載。要使用該有效載荷,您首先需要json_decode它。


以下是如何循環(huán)遍歷結(jié)果項(xiàng)以訪問(wèn)列表中的每個(gè)單獨(dú)項(xiàng)。


$itemList = json_decode($webServiceResponse->getPropsListResult);

foreach ($itemList as $item) {

   // access props like this

   echo $item->id;

   echo $item->Material;

   echo $item->SalesDescription;

   // and so on...

}

嘗試使用這樣的代碼:


$soapclient = new SoapClient('http://****.com/Pages/WebService/Keramat/KeramatWebService.asmx?wsdl');

try {

    $response = $soapclient->getCanboPropsList();

    $itemList = json_decode($response->getPropsListResult);

    foreach ($itemList as $item) {

       // access props like this

       echo $item->id;

       echo $item->Material;

       echo $item->SalesDescription;

       // and so on...

    }

}

catch(Exception $e) {

    echo ($soapclient->__getLastResponse());

    echo PHP_EOL;

    echo ($soapclient->__getLastRequest());

}


查看完整回答
反對(duì) 回復(fù) 2022-12-23
?
米琪卡哇伊

TA貢獻(xiàn)1998條經(jīng)驗(yàn) 獲得超6個(gè)贊

您也許可以執(zhí)行以下操作:


$result = <webservice response>;


foreach ($result->getPropsListResult as $prop) {

   $prop['SalesPrice']; // To get salesprice

   $prop['PlantName']; // To get plant name

}


查看完整回答
反對(duì) 回復(fù) 2022-12-23
  • 2 回答
  • 0 關(guān)注
  • 98 瀏覽

添加回答

舉報(bào)

0/150
提交
取消
微信客服

購(gòu)課補(bǔ)貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動(dòng)學(xué)習(xí)伙伴

公眾號(hào)

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號(hào)