在php中嵌套php

uttx8gqw  于 2021-06-21  发布在  Mysql
关注(0)|答案(2)|浏览(290)

所以我有这个

echo "<a class='btn btn-primary' href=''>Read more...</a>";

在php循环中,我想做如下操作:

<a class='btn btn-primary' href=“single.php?news=<?php echo “$row[‘codn’] ?>”>Read more...</a>

我怎样才能轻松地做到这一点?

cbwuti44

cbwuti441#

如下所示

echo "<a class='btn btn-primary' href='single.php?news=".$row['codn']."'>Read more...</a>";
atmip9wb

atmip9wb2#

把这个放在循环中:

echo "<a class='btn btn-primary' href='single.php?news=" . $row['codn']. "'>Read more...</a>";

相关问题