Home > Article > Backend Development > Server.HTMLEncode allows code to be displayed as source code on the page_PHP tutorial
Today, because the program needs to display the html source code written to the database in the form of html source encoding on the page, rather than being interpreted by the browser. . After searching for a long time and not knowing how to do it, I looked at a program that has the function of modifying templates. . I found a method that turned out to be an asp ^^ and wrote it down
Server.HTMLEncode
HTMLEncode
1. The HTMLEncode method applies HTML encoding to the specified string.
Syntax
Server.HTMLEncode( string )
Parameters
string
Specify the string to encode.
Example
Script
" ) %>
The paragraph tag:
NOTE The above output will be displayed by a web browser as
The paragraph tag:
If you look at the source file or open a web page in text mode, you can see the encoded HTML
2. Analysis of related examples:
rs("content")=Server.Htmlencode(Request("content")) :
rs("content") means that rs is a recordset object and content is a field in the database table; the recordset object can operate every record in the database table and every field in it.
The function of Server.Htmlencode: is to convert certain codes into html format.
Request("content") means: there is a value of an element named content in the previous page returned; it may be a text box in the form, or it may be a querystring type thing
But Judging from the name and habits, it is a multi-line text box of a form, because it is used to place content.
The overall meaning is that it puts the value in the text box passed from the previous submission page in the database Now in the content field of the opened record.