Php - 这段代码不适用于bootstrap风格 [英] Php - this code wont work with bootstrap style
本文介绍了Php - 这段代码不适用于bootstrap风格的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有以下Bootstrap代码
< li class = list-group-item > Pot na Roblek < span class = 徽章 > 2017- 08-16 < / span > < / li >
我在尝试按原样显示它时工作正常,但是当我尝试将其添加到像PHP这样的PHP脚本时他的:
如果($ result-> num_rows> 0){
while($ row = $ result-> fetch_assoc()){
echo ' < li class = \list-group-item \>'。$ row [ naslov]。' < span class = \badge \>'。$ row [ datum ]。' < / span>< / li>';
}
} 其他 {
echo 0 rezultatov;
}
代码不会工作,不会显示Bootstrap样式,而只会显示正常的列表项
我尝试了什么:
我不知道该尝试什么,但这个其他代码适用于Bootstrap :
如果($ result-> num_rows> 0){
while($ $ row = $ result-> fetch_assoc()){
echo ' < TR GT&;'跨度>;
echo ' < td class = \\ \\success \>'。$ row [ datum]。 ' < / td>';
echo ' < td class = \\ \\ success\ >'跨度>;
echo ' < a href = '。$ row [' link']。' >'。$ row [ naslov]。' < / a>';
echo ' < / td>' 跨度>;
echo ' < / tr>' 跨度>;
}
} 其他 {
echo 0 rezultatov;
}
解决方案
result-> num_rows> 0){
while(
row =
result-> fetch_assoc()){
echo ' < li class = \list-group-item \\ \\>'跨度>
I have the following Bootstrap code
<li class="list-group-item">Pot na Roblek <span class="badge">2017-08-16</span> </li>
I works fine when trying to display it as is, but when i try to add it to a php script like this :
if ($result->num_rows > 0) {
while($row = $result->fetch_assoc()) {
echo '<li class=\"list-group-item\">'.$row["naslov"].'<span class=\"badge\">'.$row["datum"] .'</span></li>';
}
} else {
echo "0 rezultatov";
}
The code wont work and wont display the Bootstrap style and will instead display only a normal "list item"
What I have tried:
I have no idea what to try, but this other code works with Bootstrap:
if ($result->num_rows > 0) {
while($row = $result->fetch_assoc()) {
echo '<tr>';
echo '<td class=\"success\">'.$row["datum"].'</td>';
echo '<td class=\"success\">';
echo '<a href="'.$row['link'].'">'.$row["naslov"].'</a>';
echo '</td>';
echo '</tr>';
}
} else {
echo "0 rezultatov";
}
解决方案
result->num_rows > 0) { while(
row =
result->fetch_assoc()) { echo '<li class=\"list-group-item\">'.
这篇关于Php - 这段代码不适用于bootstrap风格的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文