Webページのコンテンツを変数に割り当てています$html
内容の例を次に示します$html
。
<div class="content">something here</div>
<span>something random thrown in <strong>here</strong></span>
<div class="content">more stuff</div>
どのように、PHPを使用して、このような領域のコンテンツを見つける配列を作成できますか<div class="content"></div>
(上記の例の場合)、次のようになります。
echo $array[0] . "\n" . $array[1]; //etc
出力
something here
more stuff