我有以下内容:
if($skoleIsSet && !$eventIsSet) {
foreach($events as $event) {
if($event['skole_id'] == $skoleIsSet) {
$bg = $event['img_url'];
echo '<div id="events" style="background-image: url(<?php echo $bg; ?>);">
<h1>' . $event['title'] . '</h1>';
echo '<p>Beskrivelse: ' . $event['description'] . '</p>';
echo '<p>Pris: ' . $event['pris'] . '</p>';
echo '<p>Dato: ' . $event['date'] . '</p></div>';
}
我希望每个事件回显来自img_url列的url作为背景图像。我做错了什么?
编辑(#events的Css)
#events{
float: left;
line-height: 1px;
text-align: center;
opacity: 0;
padding-top: 16px;
width: 30%;
animation-name: eventsAnim;
animation-duration: 4s;
animation-fill-mode: forwards;
position: relative;
margin: auto;
}
谢谢!