This article mainly introduces the use of # includefile in html. I personally think the tutorial is good and suitable for beginners. If you need it, you can refer to the following two files a.htmand B .htm. the.htm content in the same directory is as follows:
The Code is as follows:
B .htm content:
Today: Rain 31 ℃ ~ 26 ℃
Tomorrow: thundershower 33 ℃ ~ 27 ℃
Open a directly in the browser without any display. Later, we knew that the include was SSI (Server Side was deprecated, And the.htm was changed to. aspx, and publish the page on iis, and then. you can see the content in aspx. To achieve this in html, you can use the iframe tag and find an example on the Internet:
The Code is as follows:
# Include file Usage in html
Parameters
PathType
Set the path type of FileName. A path can be of the following types:
Path type description
The file name is the relative path of the directory where the document with the # include command is located. The contained file can be in the same directory or subdirectory, but it cannot be in the upper directory of the page with the # include command.
The Virtual File name is the complete virtual path of the virtual directory on the Web site.
FileName
Name of the file to be included. FileName must contain extension of the file name, and the file name must be enclosed by quotation marks.
Note
Files containing the # include command must use the file extension mapped to the SSI interpreter; otherwise, the Web server will not process the command. By default, the extension. stm,. shtm, And. shtml are mapped to the interpreter (Ssinc. dll ). If the Internet Service Manager is installed, you can modify the default extension ing and add a new ing. See set application ing. The included files can have any file extension, but it is recommended that they be assigned a. inc extension.
Example
Differences between include file and include virtual
1. # include the relative path of the file containing the file, # include the virtual path of the file containing the virtual file.
2. In the same virtual directory, And The results are the same, but if the virtual directory is named myweb You can also debug it, but we know that Yes.
3. if a website has two virtual directories: myweb1 and myweb2, myweb1 has a file file1.asp, and myweb2 has a file file2.asp. If file1.asp wants to call file2.asp, write it like this in file1.asp: In this case, # include file cannot be used. An error is inevitable. On the contrary, files in myweb2 that contain myweb1 are the same. If the contained file is under a folder, you only need to add the folder to the virtual path.
4. Whether using # include file or # include virtual, using "/" or "/" in the path does not affect the compilation effect, and the program runs smoothly.
5. the above situations do not apply to the mutual calls of two site files, and within the same site, And It is equivalent to website. Yes.