我使用 php 从数据库中检索图像
然后我想在 html
中使用这个图像作为背景。
我尝试使用此代码,但它不起作用:
<div class="fill" style="background-image:url('<?php echo "<img src='getImg.php?id=$13'>"; ?>');"></div>
最佳答案
Rajdeep Paul 是正确的,变量也无效
您的 CSS 语法不正确:
<div class="fill" style="background-image:url('<?php echo "getImg.php?id=$X13" ?>')"></div>
没有<img src
...
关于php - 在 php 中使用背景图像,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37175043/