使用Ganon或任何其他php库删除属性
我正在尝试用修改DOM 我的代码:使用Ganon或任何其他php库删除属性,php,html-parsing,ganon,Php,Html Parsing,Ganon,我正在尝试用修改DOM 我的代码: <?php include 'ganon.php'; // Create DOM from URL or file $html = file_get_dom('index.html'); echo $html('tr',2)->getPlainText(); 我怀疑删除一个属性会删除一个标记,而这些标记中的任何一个都不会对纯文本起作用。但是,在Stackoverflow上,我们不再提供库建议。如何使用Ganon应该在Ganon的文档中进行概述
<?php
include 'ganon.php';
// Create DOM from URL or file
$html = file_get_dom('index.html');
echo $html('tr',2)->getPlainText();
我怀疑删除一个属性会删除一个标记,而这些标记中的任何一个都不会对纯文本起作用。但是,在Stackoverflow上,我们不再提供库建议。如何使用Ganon应该在Ganon的文档中进行概述。Ganon支持CSS3选择器:-我会使用这些来查找您想要操作的元素。要删除标记,可能需要使用detach方法:
$node->detach()代码>更多:
$html('tr',2)->getPlainText()->deleteAttribute('tr');