예를 들어 더 이상 태그가없는 주 div로 콘텐츠를 가져오고 싶습니다. "Harvard Pilgrim HealthCare에서 가져온 Winter Skate, 하루 제공 올 겨울의 캐빈 열풍에 대한 완벽한 치료법입니다. " 내가 여기에 간단한 HTML DOM과 XPath를 사용하고있어 내 코드간단한 HTML DOM이있는 Xpath는 태그의 텍스트()를 가져올 수 없습니다.
foreach($dom->find('//*[@id="main"]/text()[1]') as $element){
$details=$element;
}
이지만 어느 쪽도 모든 요소를 점점 나 foreach 문으로 이동합니다. 해결책을 제안 해 주시겠습니까?
<div id="main">
<div>a</div>
<div>b</div>
<div>c</div>
<a name="abc"></a>Winter Skate brought to you by Harvard Pilgrim HealthCare, offering day and evening public skating, is the perfect remedy to cabin fever this winter.<br />
<br />
A fun and affordable activity for parents with children, Winter Skate is also an ideal lunch break getaway and a romantic addition to a dinner date at Patriot Place. <br />
<br />
The 60-by-140-foot, refrigerated ice surface is designed specifically for recreational skating and the professional surface is large enough to accommodate beginners and experts alike.<br />
<br />
On-site skate rentals, concessions and bathrooms are available and parking is free.<br />
<br />
<br />
<b>Concessions</b><br />
Dunkin Donuts will be on-site with coffee, hot chocolate and donuts available for purchase. Additionally, Patriot Place features 16 dining and quick service restaurants including: Bar Louie, Baskin Robbins, Blue Fin Lounge, CBS Scene, Davio’s, Five Guys Burgers, Godiva, Olive Garden, Qdoba, Red Robin, Skipjack’s, Studio 3, Tastings Wine Bar & Bistro, Tavolino Pizza Gourmet, Twenty8 Food & Spirits.<br />
<br />
NOTE: Hours may occasionally vary due to inclement weather, Patriots home games, or pre-scheduled private events – please check back or call 508-203-2100<br><br>
<a name='hours' class='ranchor'></a>
</div>
thanks cwallenpoole. –