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

PHP code to convert text to HTML

WBOY
Release: 2016-07-25 09:02:45
Original
960 people have browsed it
  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. ?>
复制代码


Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template