在php上的str_replace中用&#34; <! - ?“替换一个字符

时间:2015-10-08 06:58:06

标签: php html special-characters str-replace

我想在php中用FileBegin=20151001 Begin=0001-Testing-1 End=0001-Testing-1 Begin=0002-Testing-2 End=0002-Testing-2 Begin=0003-Testing-3 End=0003-Testing-3 FileEnd=20151001 字符串替换一个字符。

<?

但它在html中显示为评论: $tp ="UtmpV"; $tp = str_replace("U", "<?", $tp); $tp = str_replace("V", " ; ?>", $tp); echo $tp;

我该怎么做?

1 个答案:

答案 0 :(得分:1)

不确定您在此尝试实现的目标,但请尝试:

$tp ="UtmpV"; 
$tp = str_replace("U", "&lt;? ", $tp);
$tp = str_replace("V", " ?&gt;", $tp);
echo $tp;
祝你好运!