Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我想在一个看起来像这样的元素上添加两个属性:
$tutTag->appendChild( $xmlDoc->createElement("Port", $serv->STMPPort) )->setAttribute("type","int")->appendChild->setAttribute("y","l");
在这种情况下,“type”和“int”被添加就好了,但是第二组“y”和“l”没有被添加。我该如何解决?
也许您应该先将其添加到变量中。
$childTag = $xmlDoc->createElement("Port", $serv->STMPPort); $childTag->setAttribute("type","int"); $childTag->setAttribute("y","1"); $tutTag->appendChild($childTag);