您的假设是正确的。采用
$officeXML->{'document-meta'}使它工作。
请注意,以上内容适用于Element节点。属性节点(转储SimpleXmlElement时位于@attributes属性内的属性节点)在连字符后不需要访问任何特殊语法。可以通过数组符号定期访问它们,例如
$xml = <<< XML<root> <hyphenated-element hyphenated-attribute="bar">foo</hyphenated-element></root>XML;$root = new SimpleXMLElement($xml);echo $root->{'hyphenated-element'}; // prints "foo"echo $root->{'hyphenated-element'}['hyphenated-attribute']; // prints "bar"有关更多示例,请参见手册中的SimpleXml基础



