dqcz57269 2014-04-11 14:51
浏览 27

如何在PHP中为图像提供链接?

I need to give these images a link from my db. I have a column in the same table that holds a link, the column is titled "product_url". I am so new to this, that everything I try keeps giving me an error. I want to make the title and the screenshots link to the product url page. Can anyone offer any advice, pls?

<div class="app-title"><?=$title?></div>

<span class="app-screenshots">

<?php 
     if (!empty($app['additional_images'])) echo'<span>'.$app['additional_images'].'</span>';
     if (!empty($app['additional_images_2'])) echo '<span>'.$app['additional_images_2'].'</span>';
?>

I know I should at least try to provide my own answer, but I can't even do that. I've been trying for days and doing nothing but wasting my time. thank you for any help.

  • 写回答

3条回答 默认 最新

  • dongmaoxi0477 2014-04-11 14:56
    关注

    Maybe what you are looking for is :

    echo '<span><img src="'.$app['additional_images'].'"></span>';
    

    (if $app['additional_images'] is the link to your image file)


    EDIT

    If you want the image to link to a specific url, let's say 'myPage.html' :

    echo '<span><a href="myPage.html"><img src="'.$app['additional_images'].'"></a></span>';
    
    评论

报告相同问题?

悬赏问题

  • ¥15 如何用Labview在myRIO上做LCD显示?(语言-开发语言)
  • ¥15 Vue3地图和异步函数使用
  • ¥15 C++ yoloV5改写遇到的问题
  • ¥20 win11修改中文用户名路径
  • ¥15 win2012磁盘空间不足,c盘正常,d盘无法写入
  • ¥15 用土力学知识进行土坡稳定性分析与挡土墙设计
  • ¥70 PlayWright在Java上连接CDP关联本地Chrome启动失败,貌似是Windows端口转发问题
  • ¥15 帮我写一个c++工程
  • ¥30 Eclipse官网打不开,官网首页进不去,显示无法访问此页面,求解决方法
  • ¥15 关于smbclient 库的使用