【发布时间】:2020-09-29 07:32:23
【问题描述】:
我希望在天气应用程序上根据季节改变我的背景。
{% set season = data.date | date('d-m') %}
{% if (season >= '21-09') and (season < '21-12') %}
<style>
.card-weather .card-body:first-child
{
background: url(https://cdn.pixabay.com/photo/2018/01/09/20/22/tree-3072431_1280.jpg) no-repeat center;
}
</style>
{% elseif (season >= '21-12') and (season < '21-03') %}
<style>
.card-weather .card-body:first-child
{
background: url(https://cdn.pixabay.com/photo/2019/01/20/11/32/eiskristalle-3943558_1280.jpg) no-repeat center;
}
</style>
{% elseif (season >= '21-03') and (season <= '21-06') %}
<style>
.card-weather .card-body:first-child
{
background: url(https://cdn.pixabay.com/photo/2017/04/12/16/22/oilseed-rape-2224941_1280.jpg) no-repeat center;
}
</style>
{% elseif (season >= '22-06') and (season <= '21-09') %}
<style>
.card-weather .card-body:first-child
{
background: url(https://cdn.pixabay.com/photo/2019/06/27/03/42/beach-4301479_1280.jpg) no-repeat center;
}
</style>
{% endif %}
我将在我的控制器中查找我的日期来我的数据。 我没有看到我的错误。
【问题讨论】:
-
您好,欢迎来到 Stack Overflow。这是一个英文网站。标题中的文字是您收到的错误消息,还是只是您忘记翻译的内容?
-
“我要在我的控制器中查找我的日期来我的数据” 无法理解。您的意思是您正在尝试在控制器中查找日期?