To retain the html code entered by the user, the following is the html code: {code ...} sorry, I am not clear enough. What I want to say is: a {code ...} these two rows are the data submitted by the user, perhaps through the editor, or manually input by the user, the server-side program (such... to retain the html code entered by the user, the following is the html code:
a
b
How is this done?
Sorry, I am not clear enough. What I want to say is:
A
b
These two lines are the data submitted by the user, maybe through the editor, or manually input by the user. The data received by the server-side program (such as php) is the above two lines of characters, I would like to ask if the browser displays the two lines of code again and the p and p elements can be parsed by the browser, that is:In the browser, there is a red character a and a green character B. Is there any good way to output them directly to the browser?Because I am worried that the output user's input data will damage the page structure, such:
<
P style = "color: red">
A
Will include an unclosed p tag
Reply content:
To retain the html code entered by the user, the following is the html code:
a
b
How is this done?
Sorry, I am not clear enough. What I want to say is:
A
Set< >Several common symbols in the Code are escaped and converted into HTML Object Storage. PHP provides the htmlspecialchars function.
Yes, you can use the code editor.
For example:
A
B
I entered this in the comment box.
a
b
Can be converted
<p style="color:red">a</p><p style="color:green">b</p>
In general, these code symbols are escaped into html for storage. Generally, relevant functions are available in languages.