我有字符串,例如
<p>
<style type="text/css">
P { margin-bottom: 0.21cm; direction: ltr; color: rgb(0, 0, 0); }P.western { font-family: "Times New Roman",serif; font-size: 12pt; }P.cjk { font-family: "Arial Unicode MS",sans-serif; font-size: 12pt; }P.ctl { font-family: "Tahoma"; font-size: 12pt; } </style>
</p>
<p align="CENTER" class="western" style="margin-bottom: 0cm">
<font size="5" style="font-size: 20pt"><u><b> TEXT I WANT TO GET </b></u></font></p>
我怎样才能剥离 html、css 并只获取文本?
我知道strip_tags()
,我可以用 编写函数preg_replace
,但是 php 有一个可行的解决方案吗?谢谢。