SSI 命令不适用于 iis 中的 shtml 文件
以下代码应显示端口或服务器名称,而不是两者都显示。
无论如何我总是得到两者?
<!--#if expr="${SERVER_PORT} = 80" -->
<!--#echo var="SERVER_PORT"-->
<!--#else -->
<!--#echo var="SERVER_NAME"-->
<!--#endif -->
我也尝试了以下方法,但也没有任何乐趣:
<!--#if expr="${SERVER_PORT} = '80'" -->
<!--#if expr="${SERVER_PORT} = /80/" -->
我如何让它工作?
The following code should show either the port or server name not both.
I always get both no matter what ?
<!--#if expr="${SERVER_PORT} = 80" -->
<!--#echo var="SERVER_PORT"-->
<!--#else -->
<!--#echo var="SERVER_NAME"-->
<!--#endif -->
I have also tried the following with no joy either:
<!--#if expr="${SERVER_PORT} = '80'" -->
<!--#if expr="${SERVER_PORT} = /80/" -->
How do I get this working?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
如果您使用的是 IIS 6,请检查是否允许服务器端包含:
扩展
允许
如果是,则检查网站属性中是否启用了 SSI 脚本映射:
.shtm、
映射到shtml 和 .stm
C:\WINDOWS\system32\inetsrv\ssinc.dll
并且动词设置为
GET
和
POST
。更新:
IIS 不支持
#if/#else/#endif
构造或#set
。 IIS 6.0 的服务器端包含指令记录如下:这些适用于所有人意图和目的与 IIS 5.1 中使用的相同。
Apache 支持您尝试使用的指令,但您应该咨询您的托管商/管理员以确保它们已启用。欲了解更多信息,请参阅:
If you're using IIS 6 check that Server Side Includes are permitted:
Extensions
Allowed
If they are, then check that the SSI Script Maps are enabled in the web site properties:
.shtm,
are mapped toshtml and .stm
C:\WINDOWS\system32\inetsrv\ssinc.dll
and that the verbs are set to
GET
and
POST
.Updated:
IIS doesn't support the
#if/#else/#endif
construct or#set
. IIS 6.0's Server Side Include directives are documented here:These are for all intents and purposes the same as those used in IIS 5.1.
The directives you're trying to use are supported on Apache, though your should check with your hoster/admin to make sure they're enabled. For more info see: