使用简单的Bootstrap网格,但崩溃无效

问题描述

这是我的代码,我刮了一些旅馆(名称,图像等),然后将它们放在一个数组中。之后,我使用一个简单的引导网格来显示它们。但事实是,折叠按钮不起作用,我也不知道为什么...我在<head> </head>中拥有所有正确的脚本,但它根本不起作用!如果我尝试在空白的新索引中使用折叠代码,则折叠按钮正在工作...请帮助。

 foreach ($hotels as $hotel) {

   if ($hotel['stars'] > 0 && $hotel['stars'] <= 5){
       $hotel['stars'] = "<img class='img-rounded' src='images/{$hotel['stars']}.png' alt='Hotel' height='64px'>";
   }

   echo  "<div class='container'>";
   echo     "<div class='row'>";
   echo         "<div class='col-md-'>";
   echo             "<img class='img-rounded' src='{$hotel['image']}' alt='Hotel' height='200px'><br><br>";
   echo         "</div>";
   echo         "<div class='col-sm'>";
   echo             "<h5>{$hotel['name']} </h5><br>";
   echo             "<h6>{$hotel['description']}</h6><br>";
   echo             "scored : <b>{$hotel['score']} / 10</b><br><hr>";
   echo             "Cleanliness : <b>{$hotel['cleanliness']} / 10</b><hr>";
   echo             "Comfort : <b>{$hotel['comfort']} / 10</b><hr>";
   echo             "Location : <b>{$hotel['location']} / 10</b><hr>";
   echo             "Facilities : <b>{$hotel['facilities']} / 10</b><hr>";
   echo             "Hotel Staff : <b>{$hotel['staff']} / 10</b><hr>";
   echo             "Value for money: <b>{$hotel['value_for_money']} / 10</b><hr>";
   echo             "Free WiFi : <b>{$hotel['free_wifi']} / 10</b><hr>";
   echo             "<button class='btn btn-primary' type='button' data-toggle='collapse' data-target='#collapseExample' aria-expanded='false' aria-controls='collapseExample'>Button with data-target</button>";
   echo             "<div class='collapse' id='collapseExample'>";
   echo             "<div class='card card-body'>";
   echo                 "dfhsagfh";
   echo         "</div>";
   echo         "<div class='col-sm'>";
   echo             "{$hotel['stars']}<br>";
   echo             "<button class='btn btn-primary' ><a style='color:white;' href='https://www.booking.com/{$hotel['url']}' target='_blank'>Booking.com</a></button><br><br>";
   echo         "</div>";
   echo  "    </div>";
   echo  "</div><br>";

   echo  "<center> <div style='width:60%;'> <hr> </div> </center><br>";

    }
} else {
echo $data["reason"];
}

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)