`
joan0106
  • 浏览: 143676 次
  • 性别: Icon_minigender_2
  • 来自: 杭州
社区版块
存档分类
最新评论

显示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
?>

 

 

 

 

1
0
分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics