【问题标题】:Javascript function to include SSI depending on time and day of week根据时间和星期几包含 SSI 的 Javascript 函数
【发布时间】:2012-12-30 16:37:51
【问题描述】:

我正在寻找一段获取时间和星期几的代码,然后根据返回的内容包含 SSI html。

我尝试过调整 Java 和 PHP,但似乎没有任何效果。有什么想法吗?

【问题讨论】:

    标签: javascript ssi


    【解决方案1】:

    您可以使用 PHP 函数 include() 而不是使用 SSI。

    例如

    if (date("d") == 1) {
       include("firstday.html");
    } else {
       include("default.html");
    }
    

    此代码包含每个月的第一天的文件 firstday.html,并包含其他日子的 default.html。

    对于其他情况,您可以阅读 PHP 函数 date() 的说明

    【讨论】:

      猜你喜欢
      • 2016-10-22
      • 1970-01-01
      • 2016-05-23
      • 2011-02-12
      • 2021-07-30
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2015-08-19
      相关资源
      最近更新 更多