我收到如下网络服务回复:
<text><span class="TitleServiceChange" >Service Change</span>
<span class="DateStyle">
&nbsp;Posted:&nbsp;10/19/2016&nbsp; 8:04PM
</span>
<br/>
<br/>
<P><STRONG>B103-Ltd</STRONG> and <STRONG>BM2 </STRONG>buses are detoured due to paving on Avenue M between Remsen Av and E. 95 St. </P>
<P>Detour is as follows: </P>
<P><STRONG>Eastboun</STRONG>d: Via Avenue M. right on Remsen Av, left on Avenue N, left on Rockaway Pkwy, right on Avenue M and regular route. </P>
<P><STRONG>Westbound</STRONG>: Via Avenue M, left on E. 95 St, right on Avenue N, right on E. 85 St, right on Remsen Av, left on Avenue M, and regular route. </P>
<P>All corresponding stops will be made along the detoured route. </P>
<P>Allow additional travel time. </P>
<br/>
<br/></text>
我不是特别相信这种符号是什么,但似乎&lt;&gt; HTML标签已被转换为&amp; lt和&amp; gt(小于和大于)与其他HTML。有没有办法清理这个响应,所以我可以使用纯文本?
答案 0 :(得分:1)
首先使用htmlspecialchars_decode将特殊字符转换为HTML标记,然后使用strip_tags中的结果字符串删除html标记。在它之后你将只有文字。