Home >Backend Development >PHP Tutorial >PHP code to convert text to HTML

PHP code to convert text to HTML

WBOY
WBOYOriginal
2016-07-25 09:02:45990browse
  1. //文本转HTML
  2. function Text2Html($txt)
  3. {
  4. $txt = str_replace(” ”,” ”,$txt);
  5. $txt = str_replace(“<”,”<”,$txt);
  6. $txt = str_replace(“>”,”>”,$txt);
  7. $txt = preg_replace(“/[\r\n]{1,}/isU”,”
    \r\n”,$txt);
  8. return $txt;
  9. }
  10. ?>
复制代码


Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn