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.
次のような要素に 2 つの属性を追加したいと考えています。
$tutTag->appendChild( $xmlDoc->createElement("Port", $serv->STMPPort) )->setAttribute("type","int")->appendChild->setAttribute("y","l");
この場合、「type」と「int」は問題なく追加されますが、2 番目のセット「y」と「l」は追加されません。これを修正するにはどうすればよいですか?
最初に変数に追加する必要があるかもしれません。
$childTag = $xmlDoc->createElement("Port", $serv->STMPPort); $childTag->setAttribute("type","int"); $childTag->setAttribute("y","1"); $tutTag->appendChild($childTag);