Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/249.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/neo4j/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
如何将此php放入图像背景url?_Php_Image_Background - Fatal编程技术网

如何将此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?