dpgvdfg321041670 2012-04-08 21:18
浏览 53
已采纳

将多个元素与Simple HTML DOM结合使用

This is the HTML I'm trying to combine:

<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>

I want to take all of the <p> content after the p.full-url element and combine all of the <p> elements into single text string.

So that this:

  <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>

Becomes:

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." 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. Performance is more than just a stopwatch and efficient algorithms. When I think of performance, I like to take a holistic ...

Is this possible in Simple HTML DOM?

  • 写回答

1条回答 默认 最新

  • dongshan3759 2012-04-20 20:37
    关注

    I've never used simple html dom, but I think this is what you need:

    $result = '';
    foreach($html->find('p') as $p) {
       $result .= strip_tags($p->plaintext);
    }
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥66 换电脑后应用程序报错
  • ¥50 array数据同步问题
  • ¥15 pic16F877a单片机的外部触发中断程序仿真失效
  • ¥15 Matlab插值拟合差分微分规划图论
  • ¥15 keil5 target not created
  • ¥15 C/C++数据与算法请教
  • ¥15 怎么找志同道合的伙伴
  • ¥20 如何让程序ab.eXe自已删除干净硬盘里的本文件自己的ab.eXe文件
  • ¥50 爬虫预算充足,跪巨佬
  • ¥15 滑块验证码拖动问题悬赏