如何将此php放入图像背景url?
我非常感谢您在这方面的帮助: 我有一个引导转盘,我想包括来自数据库的图片。我希望它显示为背景图像,如下所示:如何将此php放入图像背景url?,php,image,background,Php,Image,Background,我非常感谢您在这方面的帮助: 我有一个引导转盘,我想包括来自数据库的图片。我希望它显示为背景图像,如下所示: <div class="carousel-item" style="background-image: url('link to image')"> <div class="carousel-item" style="background-image: url('<?php $img_url = "images/programpics/"; { echo
<div class="carousel-item" style="background-image: url('link to image')">
<div class="carousel-item" style="background-image: url('<?php
$img_url = "images/programpics/";
{
echo $img_url . $row_firstrow[ 'show_tix_phone' ];
}
?>')" id="pic1" alt="Something here" />';
这是我想为上面的“图像链接”设置的PHP代码段:
<?php
$img_url = "images/programpics/"; {
echo '<img src="' . $img_url . $row_firstrow[ 'show_tix_phone' ] . '"id="pic1" alt="Something here" />';
}
?>
希望帮助:
<div class="carousel-item" style="background-image: url(<?php echo $img_url . $row_firstrow[ 'show_tix_phone' ] ?>)">
希望帮助:
<div class="carousel-item" style="background-image: url(<?php echo $img_url . $row_firstrow[ 'show_tix_phone' ] ?>)">
“链接到图像”是样式的一部分,不允许使用诸如“img”和尖括号之类的html标记。示例语法:
background-image: url('images/bg.jpg')
记住这一点,您的代码必须如下所示:
<div class="carousel-item" style="background-image: url('link to image')">
<div class="carousel-item" style="background-image: url('<?php
$img_url = "images/programpics/";
{
echo $img_url . $row_firstrow[ 'show_tix_phone' ];
}
?>')" id="pic1" alt="Something here" />';
“链接到图像”是样式的一部分,不允许使用诸如“img”和尖括号之类的html标记。示例语法:
background-image: url('images/bg.jpg')
记住这一点,您的代码必须如下所示:
<div class="carousel-item" style="background-image: url('link to image')">
<div class="carousel-item" style="background-image: url('<?php
$img_url = "images/programpics/";
{
echo $img_url . $row_firstrow[ 'show_tix_phone' ];
}
?>')" id="pic1" alt="Something here" />';
为什么有开始括号和结束括号?style=“background image:url('link to image')-这是生成javascript?为什么有开始括号和结束括号?style=“background image:url('link to image')-这是生成javascript?