如何从数据库作为链接进行图像渲染

时间:2018-08-24 07:37:23

标签: php html mysql

<div class="col-sm-6 col-lg-3 col-md-3">
   <div style="border:1px solid #ccc; border-radius:5px; padding:16px; margin-bottom:16px; height:250px;">
      <img src="'.$row['college_image'].'" alt="" class="img-responsive" >
      <p align="center"><strong><a href="#">'. $row['product_name'] .'</a></strong></p>
      <h4 style="text-align:center;" class="text-danger" >'.$row['search_link'].'</h4>
   </div>
</div>

我想将上述img标签设为可点击链接 谢谢

1 个答案:

答案 0 :(得分:0)

<div class="col-sm-6 col-lg-3 col-md-3">
    <div style="border:1px solid #ccc; border-radius:5px; padding:16px; margin-bottom:16px; height:250px;">
        <!--- MAGIC --->
        <a href="<YOUR_URL_FROM_DATABASE">
            <img src="'.$row['college_image'].'" alt="" class="img-responsive" >
        </a>
        <!--- /MAGIC --->
        <p align="center"><strong><a href="#">'. $row['product_name'] .'</a></strong></p>
        <h4 style="text-align:center;" class="text-danger" >'.$row['search_link'].'</h4>
    </div>
</div>
相关问题