当前位置: 代码迷 >> HTML/CSS >> 展示html代码的函数
  详细解决方案

展示html代码的函数

热度:99   发布时间:2012-12-26 14:39:29.0
显示html代码的函数

php函数

htmlspecialchars()

<?php
  
    $html = htmlspecialchars("<a href='text'>test</a>");
    echo $html;
  
?>

?

nl2br()

?把'\n'换行用<br/>or<br>代替插入内容

?

example:

?

<?php
   echo nl2br("an apple is red \n you agree with me");
  
  //an apple is red<br/>
you agree with me
?>

?

?

?

?

  相关解决方案