PHP converts the text box content to HTML format,
This document describes how to convert the text box content of PHP to HTML format. We will share this with you for your reference. The details are as follows:
Sometimes we will use to display the input content in multi-line text boxes in html format, so that we can maintain the original text format, such as line breaks and carriage returns. You can implement the following functions:
Function shtm ($ design_str) {$ str = trim ($ design_str); // get the string and remove both the leading and trailing spaces and the empty carriage return. // $ str = str_replace ("<br> ", "", $ str); // remove the <br> tag // $ str = "<p> ". trim ($ str); // Add <p> $ str = str_replace ("\ r \ n", "<br>", $ str) to the text header ); // Replace the linefeed with the p tag // $ str. = "</p> \ n"; // Add </p> $ str = str_replace ("<p> </p> ","", $ str); // remove an empty section $ str = str_replace ("\ n", "", $ str ); // Remove empty rows and join a row $ str = str_replace ("</p>", "</p> \ n", $ str ); // organize the html code return $ str ;}
PS: This site also provides the following conversion tools for your choice:
Online html/js/css code filtering tool:
Http://tools.jb51.net/code/htmlfilter
Online UBB/HTML code conversion tool:
Http://tools.jb51.net/transcoding/ubb2html
Tools for html conversion to output from other languages:
Http://tools.jb51.net/code/HtmlCodeCov