我使用 simplehtmldom_1_5 从网站上抓取了 html 数据,在抓取之后,我想将每个文本插入一个<p>
标签中,每个标签的 id 都不同,<p>
如下所述:
Suppose scrapped data:
<div class="maincontainer">
<div class="first">
first text
</div>
<div class="second">
second text
</div>
<div class="third">
third text
</div>
<div class="fourth">
fourth text
</div>
fifth string
</div>
And I want result like this below:
<div class="maincontainer">
<div class="first">
<p id="1">first text </p>
</div>
<div class="second">
<p id="2">second text </p>
</div>
<div class="third">
<p id="3">third text </p>
</div>
<div class="fourth">
<p id="4">fourth text </p>
</div>
<p id="5"> fifth string </p>
</div>
伙计们,我想在刮擦期间而不是在刮擦之后这样做。