东莞网站建设手袋加工,我想要个网站,特价服务器,泰安营销型网站公司主要处理 嵌套 div#xff0c;正则无法很好的处理清洗 比如文本#xff1a; 想要移除 class quizPutTag 的div #xff0c;内部可能嵌套的还有未知层级的div【前提是html文本段是闭合标签的】 这是divtestdiv classquizPutTagtest/div正则无法很好的处理清洗 比如文本 想要移除 class quizPutTag 的div 内部可能嵌套的还有未知层级的div【前提是html文本段是闭合标签的】 这是divtestdiv classquizPutTagtest/divdiv classquizPutTagHsub2/subCsub2/subOsub4/sub•2Hsub2/subOspan dealflag1 classMathJye mathtagmath stylewhiteSpace:nowrap;wordSpacing:normal;wordWrap:normaltable cellpadding-1 cellspacing-1 stylemargin-right:1pxtbodytrtd styleborder-bottom:1px solid black;padding-bottom:1px;font-size:90%table stylemargin-right: 1px cellspacing-1 cellpadding-1tbodytrtdnbsp;nbsp;△nbsp;nbsp;/td/trtrtd stylefont-size: 90%div styleborder-top:1px solid black;line-height:1px./div/td/tr/tbody/table/td/trtrtdnbsp;/td/tr/tbody/table/spanCO↑COsub2/sub↑3Hsub2/subO↑/div保留的/div 实现code ?phpinclude ./simple_html_dom.php;$output;$inputfgets(fopen($argv[1],r));echo $input.\n\n;$html new simple_html_dom();$html-load(htmlbody.$input./body/html);$divsq $html-find(div.quizPutTag);$divsa $html-find(div.sanwser);$outputstr_replace($divsq,___,$input);$outputstr_replace($divsa,,$output);echo $divs[0].\n;echo $html.\n;$html-clear();echo $output.\n;? simple_html_dom.php转载于:https://www.cnblogs.com/cphmvp/p/4728139.html