我有以下代码:
$doc=new DOMDocument();
$doc->loadHTML($content);
$xml=simplexml_import_dom($doc); // just to make xpath more simple
//$images=$xml->xpath('(//img[@class = "thumbimage"])[1]');
for($x=1;$x<=5;$x++)
{
$images[] = $xml->xpath('(//img[@class = "thumbimage"])['.$x.']');
}
我转储 $images 我得到了这种类型的数组,请参阅底部的屏幕截图
[array](unknown name)
- [array]0
-[SimpleXMLElement Object] 0
-Properties
-[array]@attributes
[string]src = "thestring"
-Methods
__construct
__addAttribute etc
我想从每个 $images[] 数组中获取“字符串”
请看附图: