我正在努力使用Bootstrap中的模态窗口。
我有一个PHP foreach
循环,它应该显示用户上传的图库照片。目前,他们正在新窗口中打开并将用户带离我的网站,因此我想更改它以在模态窗口中打开图像。
我已经放置了一个模态窗口并且它正在触发并显示正确的图像,但是大约五秒后图像消失并被一堆字符和数字替换(看起来像某种编码。
该错误还会删除关闭按钮,这意味着您无法关闭模态窗口并返回页面。
我的代码:
<a href="uploads/gallery-photos/<?php echo htmlentities($galleryimage['GalleryPhotoImg'], ENT_QUOTES, 'UTF-8'); ?>" target="_blank" data-toggle="modal" data-target="#GalleryImgModal-<?php echo htmlentities($galleryimage['id'], ENT_QUOTES, 'UTF-8'); ?>">
<img class="gallery_thumb" alt="" src="uploads/gallery-photos/<?php echo htmlentities($galleryimage['GalleryPhotoImg'], ENT_QUOTES, 'UTF-8'); ?>" width="80px" height="120px" /></a>
<div id="GalleryImgModal-<?php echo htmlentities($galleryimage['id'], ENT_QUOTES, 'UTF-8'); ?>" class="modal fade" tabindex="-1" role="dialog" aria-labelledby="myImgModalLabel" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button><br />
<div class="modal-body">
<img src="uploads/gallery-photos/<?php echo htmlentities($galleryimage['GalleryPhotoImg'], ENT_QUOTES, 'UTF-8'); ?>" class="img-responsive">
</div>
</div>
</div>
</div>
<?php endforeach; ?>
我哪里错了?