需要使用php从包含html实体和元素的字符串中提取纯文本
我需要输出为纯文本: 东北部的居民发现,布兰福德大厅已经成为开始高增长职业生涯的最快、最有效的方式之一需要使用php从包含html实体和元素的字符串中提取纯文本,php,regex,preg-replace,Php,Regex,Preg Replace,我需要输出为纯文本: 东北部的居民发现,布兰福德大厅已经成为开始高增长职业生涯的最快、最有效的方式之一 请帮助我更正preg_replace regex?PHP有一些内置函数,应该更方便: $string = "<h2> <div class="OutlineElement Ltr SCX116040423" style="margin: 0px; padding: 0px; font-family:
请帮助我更正preg_replace regex?PHP有一些内置函数,应该更方便:
$string = "<h2> <div class="OutlineElement Ltr SCX116040423" style="margin: 0px; padding: 0px; font-family: 'Segoe UI', Tahoma, Verdana, sans-serif; font-size: 8px; font-weight: normal;"> <p class="MsoNormal">Residents of the northeast are discovering that Branford Hall has become one of the fastest and most effective ways to begin a high growth career.<o:p>"
$string = preg_replace("/&#?[a-z0-9]+;/i","",$string);
PHP有一些内置函数,应该更方便:
$string = "<h2> <div class="OutlineElement Ltr SCX116040423" style="margin: 0px; padding: 0px; font-family: 'Segoe UI', Tahoma, Verdana, sans-serif; font-size: 8px; font-weight: normal;"> <p class="MsoNormal">Residents of the northeast are discovering that Branford Hall has become one of the fastest and most effective ways to begin a high growth career.<o:p>"
$string = preg_replace("/&#?[a-z0-9]+;/i","",$string);