【问题标题】:In ASP CLASSSIC inclusions are executed before or after the statements?在 ASP CLASSSIC 中,包含在语句之前还是之后执行?
【发布时间】:2013-05-16 05:12:58
【问题描述】:

假设我们有这样的情况:

if session("lenguage") = "ENG" then

<!--#include file="eng_page.asp"-->

else

<!--#include file="not_eng_page.asp"-->

end if

我想了解结果 ASP 文件是否将包含包含的展位(然后仅执行其中一个),还是只有一个取决于会话变量。

我的意思是,我可以用它来减轻页面的重量吗?如果我知道某些 sn-ps 代码仅在它们真正应得的情况下才包含在内,那可能会有所帮助...

【问题讨论】:

    标签: asp-classic include server-side-includes


    【解决方案1】:

    对不起,我也试过了。这两个文件都将包括在内,并且不会有文件大小的好处。这是一篇文章,提供了如何解决此问题的示例。

    http://www.4guysfromrolla.com/webtech/022504-1.shtml

    【讨论】:

      【解决方案2】:

      只需使用Server.Execute:

      If Session("lenguage") = "ENG" Then
          Server.Execute("eng_page.asp") 
      Else  
          Server.Execute("not_eng_page.asp") 
      End If
      

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 2021-12-07
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2014-07-16
        • 1970-01-01
        • 2016-05-04
        • 1970-01-01
        相关资源
        最近更新 更多