Reprinted from: http://blog.csdn.net/zxl315/archive/2008/03/30/2229851.aspx
The server contains commands to include the file content and information about the file, such as the file size, into the HTML page. You can also use some server-side instructions on the ASP page.
A total of 6
# Config: Specify the format of the error message, date, and file size returned to the client browser.
# Echo: insert the environment variable value in the HTML page.
# Exec: run an application or a shell command and insert the output to the HTML page.
# Flastmod: insert the file modification date to the HTML page.
# Fsize: insert the file size to the HTML page.
# Include: contains files on HTML or ASP pages.
Because files containing SSI commands need special processing, an SSI file extension must be provided to the SSI File. The default extension is. stm,. shtm, And. shtml. However, some SSI commands can be used in other files.
1. Include files
To include files, use the # include command. For example, to insert a file named char. inc into an HTML page, you can use the following commands on the HTML page: (can be used in ASP)
<! -- # Include file = "char. inc" -->
The HTML file containing the # include command must be a file published on your Web site.
To locate the contained file by specifying the relative path of the current directory, use the file parameter. To locate the contained file by specifying the full virtual path of the file, use the virtual parameter.
2. include application output
To run an application or shell command, use the # exec command. The application can be a CGI, ASP, or ISAPI application. The application path must be a complete virtual path or URL. To pass parameters to an application, the application name is followed by a question mark (?) A column parameter connected by the plus sign (+. This command can only be used on HTML pages, but not ASP pages.
The CGI parameter runs an application, such as a CGI script, ASP, or ISAPI application.
Run the shell command with the CMD parameter.
3. File Size
# Fsize inserts the size of the specified file into the HTML page. This command can only be used on HTML pages, but not ASP pages.
The parameter settings are the same as # include
By default, the file size is represented in kilobytes. You can use the # config command with the sizefmt option to change the measurement unit.
4. # config
# Config specifies the error message, date, and file size returned to the client browser. This command can only be used in HTML pages; it cannot be used in ASP pages.
Parameter ERRMSG
Controls the messages returned to the client browser when an error occurs during the process of processing SSI commands. Disable detailed debugging information and only provide a short error message.
Example: <! -- # Config errmsg = "You are wrong! "-->
TIMEFMT
Specifies the date format returned to the client browser. The String parameter specifies the format. You can extract individual parts of a date by formatting the String, for example, a day of a week or month. (The format tag is exactly the same as the one you used when using the strftime function of ansi c ).
% A abbreviation of a day in a week (for example, Mon ).
% A the full name of A day in A week (for example, Monday ).
The abbreviation of month % B (for example, Feb ).
The full name of month % B (for example, February ).
% C represents the local date and time (for example, 05/06/91 12:51:32 ).
% D indicates the day of a month in decimal format (01-31 ).
% H 24-hour format (00-23 ).
% I 12-hour format (01-12 ).
% J indicates a day in a year in decimal format (001-366 ).
% M indicates the month in decimal format (01-12 ).
% M in decimal digits (00-59 ).
% P indicates the local morning or afternoon indicators (for example, PM ).
% S is the second in decimal format (00-59 ).
% U indicates a week in a year in decimal format. Sunday is the start of a week (00-51 ).
% W indicates a day in a week in decimal format, and Sunday is the first day (0-6 ).
% W indicates a day in a year in decimal format. Monday is the start of a week (00-51 ).
% X indicates the local date (for example, 05/06/91 ).
% X indicates the local time (for example, 12:51:32 ).
% Y indicates the year of the century (for example, 69) in decimal format ).
% Y indicates the year of the century in decimal format (for example, 1969 ).
% Z, % Z full name or abbreviation; if you do not know the time zone, there is no character.
% Percent.
Example: <! -- # Config timefmt = "% H: % M: % S" -->
The SIZEFMT parameter is followed by the ABBREV parameter, indicating that the unit is kilobytes, And the BYTE parameter is in bytes.
Example: <! -- # Config sizefmt = "bytes" -->
5. # ECHO is similar to Response. ServerVariables in ASP.
I will not introduce it in detail. It's too much.
REMOTE_ADDR and QUERY_STRING should be used.
6. # flastmod inserts the modified time of the specified file into the HTML page. This command can only be used on HTML pages, but not ASP pages.
The parameter settings are the same as # include
Index.shtml
<! -- # Config errmsg = "Error! "-->
Display current date: <! -- # Echo var = "DATE_LOCAL" -->
<Br/>
Show the current document name: <! -- # Echo var = "document_name" -->
<Br/>
Show the virtual path of the current document: <! -- # Echo var = "document_uri" -->
<Br/>
Last document Update Time: <! -- # Echo var = "LAST_MODIFIED" -->
<Br/>
Display the date and time when the server sets the time zone: <! -- # Config timefmt = "% A, the % d of % B, in the year % Y" --> <! -- # Echo var = "date_local" -->
<Br/>
Show the server host name, DNS alias or IP address: <! -- # Echo var = "server_name" -->
<Br/>
Display the server's response port: <! -- # Echo var = "server_port" -->
<Br/>
Show the server software name and version: <! -- # Echo var = "server_software" -->
<Br/>
Request Method for displaying client documentation: <! -- # Echo var = "request_method" -->
<Br/>
Show client host name, DNS alias or IP address: <! -- # Echo var = "remote_host" -->
<Br/>
Client IP address that sends the request information: <! -- # Echo var = "remote_addr" -->
<Br/>
Display the authentication method for user identity: <! -- # Echo var = "AUTH_TYPE" -->
<Br/>
The account name used by the user accessing the protected page is displayed: <! -- # Echo var = "remote_user" -->
<Br/>
<! -- The following two commands can contain html files and jsp files -->
<! -- This command can only contain files in the same directory as this file -->
<! -- # Include file = "index.html" -->
<Br/>
<! -- This command can contain files in other directories and use virtual paths -->
<! -- # Include virtual = "test. jsp" -->
<Br/>
<! -- Include a txt file -->
<P align = "center"> <! -- # Include file = "testssi.txt" --> </p>
<Br/>
Show the size of the specified file: <! -- # Fsize file = "WEB-INF/web. xml" -->
<Br/>
Error message specified at the top of the test: <! -- # Fsize file = "//" -->