单击图片重定向到一个URL,然后单击新URL的图片返回主页


image click redirecting to a URL, and then clicking on an image of the new URL to go back to main page

我正在用php做一个照片库,我的主页是一个包含所有缩略图的库。如果你点击任何缩略图,它都会链接到另一个带有原始大小图像的页面(就像谷歌图像一样)。我用一个超链接来实现这一点,其中包含一个图像:

<a href='".$row['image']."' class='image' title='".$row['title']."'>"."<img   src=".$row['thumb']." class='thumb'/>&nbsp; &nbsp; &nbsp;</a>

然后,如果用户现在在显示所选大图像的重定向页面中,我该如何做到这一点,如果用户单击大图像的顶部,它将被重定向到包含所有缩略图的主页面?

<a href="<?php echo $row['image'];?>"class='image' title="<?php echo $row['title'];?>">
  <img src="<?php echo ['thumb'];?>" class='thumb'/>&nbsp; &nbsp; &nbsp;
</a>

如果您能够使用<a href链接到详细信息页面,为什么您不能从详细信息页面进行链接?

考虑到您在列表页面上,比如listing.php,并且图像是从数据库中列出的。您可以循环浏览下面给出的图像。

  <a href="detail-image.php?id=<?php echo $image_from_database['id'];?>" class='image' title="image title">  
    <img src="<?php echo $image_from_database['thumb'];?>" class='large'/>
  </a>

因此,点击后,您将被重定向到detail-image.php,在那里您可以使用php$_get/$_REQUEST 获取id

然后从数据库中获取大图像并显示出来。在那里你可以做同样的事情来链接到列表页面

<a href="listing.php" class='image' title="image title">  
  <img src="<?php echo $image_from_database['large_image'];?>" class='thumb'/>
</a>

听着,,我不知道到底出了什么问题

但我认为你的代码有问题,

一定是这样,

<a href="<?php echo $row['image'];?>"class='image' title="<?php echo $row['title'];?>">
  
  <img src="<?php echo ['thumb'];?>" class='thumb'/>&nbsp; &nbsp; &nbsp;
</a>

页面必须是"Something.php"