基于时间的条件

KSP*_*SPR 8 expressionengine

是否可以通过服务器时间在EE中触发条件?

{if servertime == 'midnight to 13:00'}
      do this
{if:else}
      do something else
{/if}
Run Code Online (Sandbox Code Playgroud)

谢谢

Dom*_*bbs 7

当然,您可以将{current_time}全局变量用于基本条件.要使用您的示例,以下是我们如何检查午夜到13:00之间的时间:

{if
    '{current_time format="%H%i"}' >= '0000' AND
    '{current_time format="%H%i"}' <= '1300'
}
    It's between 00:00 and 13:00
{if:else}
    It isn't.
{/if}
Run Code Online (Sandbox Code Playgroud)