Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我正在使用 SimpleHTMLDOM Parser 来处理网站,我想知道是否有任何错误处理方法。例如,如果链接被破坏,那么在代码中前进并搜索文档是没有用的。
谢谢你。
<?php $html = file_get_html('http://www.google.com/'); foreach($html->find('a') as $element) { if(empty($element->href)) { continue; //will skip <a> without href } echo $element->href . "<br>\n"; } ?>
循环并继续?