2

这是我要组合的 HTML:

<div class="post linkDetail">
  <div class="postThumbnail">
    <a href="/redirect?url=http%3A//blogs.msdn.com/archive/2012/04/23/how-to-improve-performance-in-your-metro-style-app.aspx">
      <img src="<validURL Here>" width="280">
    </a>
  </div>
  <p class="full-url">
    http://blogs.msdn.com/b/windowsappdev/archive/2012/04/03/how-to-improve-performa...
  </p>
  <p></p>
  <p>Nobody likes slow or unresponsive apps. Users expect that apps respond immediately to touch,   taps, clicks, gestures and key-presses. Users expect that animations are smooth, that they can play, pause and restart their music and videos quickly, and that they never have to wait for the app to catch up with them. This is the first in a series of posts on how to make your apps "fast and fluid."    
   </p>
   <p>We invested a lot of time in the engineering teams thinking about how we can ensure the performance of Metro style apps. We have learned what we can do in the platform to deliver on fast and fluid performance and have also learned what works and what does not work in building apps that deliver great experiences. In this blog I share with you some of the hard lessons from our own experiences so that you can build the best possible experiences for your customers.</p><p>Performance is more than just a stopwatch and efficient algorithms. When I think of performance, I like to take a holistic ...
   </p>
</div>

我想获取元素<p>之后的所有内容p.full-url并将所有<p>元素组合成单个文本字符串。

这样:

  <p></p>
  <p>Nobody likes slow or unresponsive apps. Users expect that apps respond immediately to touch,   taps, clicks, gestures and key-presses. Users expect that animations are smooth, that they can play, pause and restart their music and videos quickly, and that they never have to wait for the app to catch up with them. This is the first in a series of posts on how to make your apps "fast and fluid."    
   </p>
   <p>We invested a lot of time in the engineering teams thinking about how we can ensure the performance of Metro style apps. We have learned what we can do in the platform to deliver on fast and fluid performance and have also learned what works and what does not work in building apps that deliver great experiences. In this blog I share with you some of the hard lessons from our own experiences so that you can build the best possible experiences for your customers.</p><p>Performance is more than just a stopwatch and efficient algorithms. When I think of performance, I like to take a holistic ...
   </p>

变成:

没有人喜欢缓慢或反应迟钝的应用程序。用户期望应用程序立即响应触摸、点击、点击、手势和按键。用户希望动画流畅,他们可以快速播放、暂停和重新启动他们的音乐和视频,并且他们永远不必等待应用程序赶上他们。这是关于如何让您的应用程序“快速流畅”的系列文章中的第一篇。我们在工程团队上投入了大量时间来思考如何确保 Metro 风格应用程序的性能。我们已经了解了我们可以在平台中做些什么来提供快速和流畅的性能,并且还了解了在构建可提供出色体验的应用程序时哪些有效,哪些无效。在此博客中,我将与您分享我们自己的经验中的一些艰难教训,以便您可以为您的客户打造最佳体验。性能不仅仅是一个秒表和高效的算法。当我想到性能时,我喜欢整体...

这在简单的 HTML DOM 中可能吗?

4

1 回答 1

0

我从未使用过简单的 html dom,但我认为这就是您所需要的:

$result = '';
foreach($html->find('p') as $p) {
   $result .= strip_tags($p->plaintext);
}
于 2012-04-20T20:37:52.633 回答