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

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

使用 simplexml 用 PHP 解析 XML

使用 simplexml 用 PHP 解析 XML

PHP
郎朗坤 2023-04-28 15:12:05
我正在使用 Amazon Marketplace Web Service (Amazon MWS) 獲取產(chǎn)品。我需要獲得第一個(gè)產(chǎn)品的標(biāo)題:對(duì)于 ASIN,我可以使用:$xml->ListMatchingProductsResult->Products->Product[0]->Identifiers->MarketplaceASIN->ASIN但是對(duì)于標(biāo)題,我不知道是因?yàn)椤皀s2”。這是 XML 數(shù)據(jù):<?xml version="1.0"?><ListMatchingProductsResponse xmlns="http://mws.amazonservices.com/schema/Products/2011-10-01">  <ListMatchingProductsResult>    <Products>      <Product>        <Identifiers>          <MarketplaceASIN>            <MarketplaceId>A2EUQ1WTGCTBG2</MarketplaceId>            <ASIN>B01MYV7W6A</ASIN>          </MarketplaceASIN>        </Identifiers>        <AttributeSets>          <ns2:ItemAttributes xmlns:ns2="http://mws.amazonservices.com/schema/Products/2011-10-01/default.xsd" xml:lang="en-CA">            <ns2:Binding>Automotive</ns2:Binding>            <ns2:Brand>Multiple Manufacturers</ns2:Brand>            <ns2:ItemDimensions>              <ns2:Weight Units="pounds">12</ns2:Weight>            </ns2:ItemDimensions>            <ns2:Label>Multiple Manufacturers</ns2:Label>            <ns2:Manufacturer>Multiple Manufacturers</ns2:Manufacturer>            <ns2:Model>AC1000149R</ns2:Model>            <ns2:PackageDimensions>              <ns2:Height Units="inches">18</ns2:Height>              <ns2:Length Units="inches">78</ns2:Length>              <ns2:Width Units="inches">38</ns2:Width>              <ns2:Weight Units="pounds">12</ns2:Weight>            </ns2:PackageDimensions>            <ns2:PackageQuantity>1</ns2:PackageQuantity>            <ns2:PartNumber>AC1000149R</ns2:PartNumber>            <ns2:ProductGroup>Automotive Parts and Accessories</ns2:ProductGroup>            <ns2:ProductTypeName>AUTO_ACCESSORY</ns2:ProductTypeName>            <ns2:Publisher>Multiple Manufacturers</ns2:Publisher>
查看完整描述

1 回答

?
慕尼黑的夜晚無繁華

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

這是我找到的解決方案:


$ItemAttributes = $xml->ListMatchingProductsResult->Products->Product[$i]->AttributeSets->ItemAttributes;

$ItemAttributes->registerXPathNamespace('ns2', 'http://mws.amazonservices.com/schema/Products/2011-10-01/default.xsd');

$titles = $ItemAttributes->xpath("//ns2:Title");  // <= this is array


查看完整回答
反對(duì) 回復(fù) 2023-04-28
  • 1 回答
  • 0 關(guān)注
  • 112 瀏覽

添加回答

舉報(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)