我在SSI的if声明上遇到麻烦。我在两台计算机上重新安装了OSes (,一台带有win7,另一台用win8),并在它们上安装了WAMP。然后我把我的旧项目放在文件夹里。在打开使用SSI的项目后,如果收到以下错误消息:
处理此指令时发生错误
问题是,当我在工作中打开那些文件和我的笔记本电脑时,我不会丢失这个错误。
之后,我切换到了XAMPP,但是再次得到了相同的错误。
我使用以下声明:
<!--#if expr="$DOCUMENT_NAME = home.html"-->
<body class="home">
<!--#else-->
<body>
<!--#endif-->它似乎输入了if语句,因为它将body类放入".home",然后是消息。
其他的都行,但是if语句有效。我已经将我的header.shtml和footer.shtml分开,并在站点中加载它们。但当我用“如果-它坏了”的时候。
我不认为这与此相关,但以防万一--这是我的.htaccess文件的样子:
Options +Includes
AddHandler server-parsed .shtml .html .htm发布于 2014-12-27 06:13:36
将SSILegacyExprParser on添加到.htaccess中
请参考此链接。
发布于 2014-05-04 18:35:52
您还需要更改httpd.conf文件,因为默认情况下,Apache中没有打开SSI。
查找httpd.conf文件的这一部分
#
# Filters allow you to process content before it is sent to the client.
#
# To parse .shtml files for server-side includes (SSI):
# (You will also need to add "Includes" to the "Options" directive.)
#
#AddType text/html .shtml
#AddOutputFilter INCLUDES .shtml并将其改为
#
# Filters allow you to process content before it is sent to the client.
#
# To parse .shtml files for server-side includes (SSI):
# (You will also need to add "Includes" to the "Options" directive.)
#
AddType text/html .shtml
AddOutputFilter INCLUDES .shtmlhttps://stackoverflow.com/questions/23454648
复制相似问题