<!--#include virtual="/scripts/myfile.txt"-->
<!--#include file="myfile.txt"-->
virtual是基于"虚拟目录"的,在nginx上写../的相对路径都是好的(需修改点nginx源码),但在iis不行
file是基于(当前)文件的,可以写绝对路径,也可以写相对路径../,在iis下可以。
More Information on File and Virtual Syntax
SSI directives that use file paths can reference files by using a file or virtual path.
- The file element is used with files that are relative to the folder of the current document. The following example includes a file in the current folder:
<!--#include file="myfile.txt"--> - The virtual element represents paths that are relative to the base folder of the Web server. The following example includes a file in the /scripts virtual folder:
<!--#include virtual="/scripts/myfile.txt"-->
本文详细解析了服务器端包含(Server Side Includes, SSI)中file与virtual两种路径引用方式的区别及应用场景。file指令用于引用当前文档所在目录的相对路径或绝对路径的文件;而virtual指令则用于引用相对于Web服务器根目录的路径。
713

被折叠的 条评论
为什么被折叠?



