| 注册
请输入搜索内容

热门搜索

Java Linux MySQL PHP JavaScript Hibernate jQuery Nginx
jopen
13年前发布

PHP的HTML解析 wiseparser

     <p>wiseparser 是一个 PHP 语言用来解析 HTML 文档的开发包。</p>    <p>示例代码:</p>    <p></p>    <pre class="brush:php; toolbar: true; auto-links: false;">require_once('treebuilder.php');  $mytree = new Tree();<br> $mytree->parse_content('&lt;div&gt;Hello world&lt;/div&gt;'); // or $mytree->parse_file('http://www.google.com'); $mytree->parse_file('myfile.htm');  // To print HTML, just do: echo $mytree;  // For those of you who familiar with HTML::Treebuilder, usage is almost the same. Implemented methods:   // same as HTML::Element Element->attr($attr, $value = null); Element->tag($tag = null); Element->look_down($keys); Element->traverse($callback, $text_only=false); Element->push_content($test_or_node, ..); Element->unshift_content($test_or_node, ..); Element->detach(); Element->preinsert($test_or_node, ..); Element->postinsert($test_or_node, ..); Element->as_HTML(); Element->as_text(); // plus one additional method: Element->seek_n_destroy($keys); // same as look_down()->detach()->__destruct();  // same as HTML::Treebuilder: Tree->parse_content($content); Tree->parse_file($filename_or_url);</pre>    <p></p>    <p><strong>项目主页:</strong><a href="http://www.open-open.com/lib/view/home/1324432405780" target="_blank">http://www.open-open.com/lib/view/home/1324432405780</a></p>     
 本文由用户 jopen 自行上传分享,仅供网友学习交流。所有权归原作者,若您的权利被侵害,请联系管理员。
 转载本站原创文章,请注明出处,并保留原始链接、图片水印。
 本站是一个以用户分享为主的开源技术平台,欢迎各类分享!
 本文地址:https://www.open-open.com/lib/view/open1324432405780.html
PHP HTML操作类库