我想在节点内插入不同的节点。但我不知道如何动态地做到这一点
我有这个 xml 文件:
<?xml version='1.0' encoding='UTF-8'?>
<article artId="4686453" artName="UHOPI20190218-012A" Author="" Comment="" PubDate="2019-02-18" Section="country">
<head>
<headline>this is the title </headline>
<summary>
autor name @twitter
</summary>
</head>
<body>
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer venenatis eleifend dui, at egestas sapien lobortis viverra.
<!-- insert pullquotes here -->
</body>
<pullquote title="" catsList="" summary="" notes="" sectionColor="" sectionHead="">
Lorem ipsum dolor sit amet
<summary xml:space="preserve">Lorem ipsum dolor sit amet, consectetur adipiscing elit.
</summary>
</pullquote>
<pullquote title="" catsList="" summary="" notes="" sectionColor="" sectionHead="">
<headline xml:space="preserve">Some text</headline>
<summary xml:space="preserve">Some text</summary>
<summary xml:space="preserve">Some text</summary>
</pullquote>
</article>
我试试这个……但它不起作用
$xml = simplexml_load_file("files/test2.xml");
$body = $xml->body;
$pull1 = $xml->pullquote[0];
$body->addChild($pull1);
我想在节点内插入每个节点我该怎么做?
UYOU