我想在simplexml对象中动态定义fetched属性的属性路径。我试过跟随,但它没有用。这可能在PHP吗?
$xml = $z->readOuterXML();
$item = simplexml_load_string($xml);
// This works
echo $item->attribute1->attribute2->attribute3;
// However I want to dynamically define path for attribute like this, this example is not really working
$path = "attribute1->attribute2->attribute3";
echo $item->{$path};