【问题标题】:background-image using php and stored path in mysql使用 php 的背景图像和 mysql 中的存储路径
【发布时间】:2014-10-02 21:12:39
【问题描述】:

我正在尝试弄清楚如何从 MySQL 中提取路径(例如 images/img1.png)并将其回显到

<div class="fullscreen" style="background-image:url('<?php echo $query['image'] ?>');background-position:100% 50%;" data-img-width="1600" data-img-height="1064">

但是,图像没有返回,我不知道为什么。

【问题讨论】:

    标签: php html mysql css


    【解决方案1】:

    很抱歉浪费了您的时间。我刚刚想通了。我忘了在我的选择语句中选择图像!

    我有 SELECT text FROM table 而不是 SELECT text, image FROM table

    【讨论】:

      【解决方案2】:

      我想这会对你有所帮助.. &lt;div class="fullscreen" style="background-image:url('folderpath/&lt;?=$query['image'];?&gt;');background-position:100% 50%;" data-img-width="1600" data-img-height="1064"&gt;

      【讨论】:

        猜你喜欢
        • 2020-12-11
        • 2012-02-19
        • 1970-01-01
        • 2013-06-04
        • 2020-05-15
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多