요소의 태그간에 내용을 일치시키기 위해 PHP의 정규식이 필요합니다 (예 : <body>
및 </body>
perl 호환 preg_match
입니다.PHP에서 HTML 본문의 내용과 일치하는 정규 표현식
은 지금까지 나는 시도했다 :
// $content is a string with html content
preg_match("/<body(.|\r\n)*\/body>/", $content, $matches);
print_r($matches);
...하지만 출력은 빈 배열입니다. 같은 문서에서 설명
preg_match("/<body.*\/body>/s", $content, $matches);
:
덕분에 일했다! – Spoike