0
我對如何與寬度的圖像訪問SourceUrl問題= 400PHP XML的xpath如何提取所需的匹配
圖像/二/ 47/6B/77/454430384d6d324b413332544a695675313851-400x400-0-0.jpg 2 P = p2.7f19fe93a466ae45afab &一個= 1 & C = 1 &升= 7000610 & R = 1個& PR = 1個& LKS = 43998 & FKS = 35198
默認它顯示我的圖像與寬度= 100和我的某種方式xpath語法不能提取400
<?php
$string = <<<XML
<imageList>
<image available="true" height="100" width="100">
<sourceURL>images/di/47/6b/77/454430384d6d324b413332544a695675313851-100x100-0-0.jpg?p=p2.7f19fe93a466ae45afab&a=1&c=1&l=7000610&r=1&pr=1&lks=43998&fks=35198</sourceURL>
</image>
<image available="true" height="200" width="200"><sourceURL>images/di/47/6b/77/454430384d6d324b413332544a695675313851-200x200-0-0.jpg?p=p2.7f19fe93a466ae45afab&a=1&c=1&l=7000610&r=1&pr=1&lks=43998&fks=35198</sourceURL></image>
<image available="true" height="300" width="300"><sourceURL>images/di/47/6b/77/454430384d6d324b413332544a695675313851-300x300-0-0.jpg?p=p2.7f19fe93a466ae45afab&a=1&c=1&l=7000610&r=1&pr=1&lks=43998&fks=35198</sourceURL></image>
<image available="true" height="400" width="400"><sourceURL>images/di/47/6b/77/454430384d6d324b413332544a695675313851-400x400-0-0.jpg?p=p2.7f19fe93a466ae45afab&a=1&c=1&l=7000610&r=1&pr=1&lks=43998&fks=35198</sourceURL></image>
<image available="true" height="569" width="500"><sourceURL>images/di/47/6b/77/454430384d6d324b413332544a695675313851-500x569-0-0.jpg?p=p2.7f19fe93a466ae45afab&a=1&c=1&l=7000610&r=1&pr=1&lks=43998&fks=35198</sourceURL></image></imageList>
XML;
$xml = simplexml_load_string($string);
$result = $xml->xpath("//image[@height='400']/sourceURL");
?>