如何显示我的Tags
值作为这样的后标签example?显示多个不带逗号的值
产品表中
+----+--------+--------------------------+
| ID | Name | Tags |
+----+--------+--------------------------+
| 1 | Shirt | Shirt,Clothes,Blue-Shirt |
| 2 | Shoes | Shoes,Red-Shoes |
| 3 | Jacket | Jacket,Clothes |
+----+--------+--------------------------+
CODE
<?php
$result= mysql_query("SELECT * FROM product") or die (mysql_error());
while ($rows = mysql_fetch_array ($result))
{
?>
<div class="post">
Product name : <?php echo $rows['name']; ?>
<ul class="tags">
<li>Tagged :</li>
<li><a href="#"><?php echo $rows['tags']; ?></a></li>
</ul>
</div>
<?php } ?>
我的代码给了这个result。
你可以使用'爆炸();'创建每个项目的标签的数组,然后循环它们。 – Epodax
我不知道如何使用'explode();',请给我举个例子吗? –
[我会简单地使用'implode'和'explode'](https://3v4l.org/sG9fm) –