Php在设定日期后显示信息 [英] Php show info after a set date
问题描述
谢谢你花时间看我的问题。我目前有一个Php脚本,允许我在设定的日期后隐藏内容并将其替换为默认文本,您可以在下面看到:
Hi and thanks for taking the time to look at my question. I currently have a Php script that allows me to hide content after a set date and replace it with a default text, you can see it below:
<?php if (date('Y-m-d') <= '2018-05-30') { ?>
<li><p>Apply to Graduate:</p>
<p><a href="app-graduate-form.php" class="applyBtn">Apply to Graduate</a></p>
</li>
<?php } else { ?>
<p><li>The application to graduate is not available at this time. If you qualify to graduate, the Registrar’s Office will notify you when the application to graduate is available.</li></p>
<?php } ?>
我现在要做的是添加一个额外的脚本,在设定的日期将其重新打开,所以基本上它可以两种方式运行,在设定的日期之后隐藏内容然后激活内容一旦又来了,我一直很难搞清楚,如果你能帮我一把,我很乐意!
非常感谢你的时间和你的帮助。
我尝试过:
我尝试添加elseif但到目前为止没有运气。
What I am trying to do now is add an extra script that turns it back on in a set date so basically it functions both ways, hiding content after a set date and then activate the content once another date comes, I have been having a hard time figuring it out and I would love if you can give me a hand!
Thanks a lot for your time and your help.
What I have tried:
I tried adding elseif but no luck so far.
推荐答案
你要找的是逻辑OR 。
What you are looking for is a Logical OR.
<?php if (( date('Y-m-d') <= '2018-05-30') || ( date('Y-m-d') >= '2018-08-01')) { ?>
感谢您的回复!你能解释一下吗?是再次激活内容的第二个日期?
再次感谢!
Thanks for your response! Can you explain it a little more? is the second date the when the content would be activated again?
Thanks again!
这篇关于Php在设定日期后显示信息的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!