连接CSS后台url

I have css like this :

<?php echo "<div style='background-image: url(images/$hb1[img_name]);' >"; ?> 

I want to concatenate the variable inside background url and the css become like this :

<?php echo "<div style='background-image: url('images/$hb1[img_name]');' >"; ?>

How could I to do that ?

You could make this a bit simpler and just echo what you need to in php e.g

<div style="background-image: url('images/<?php echo $hb1['img_name']; ?>')">

I noticed in your original code you didn't have any quotes around you array key so this could have been an issue for you. So to take your original code it would be

<?php echo "<div style=\"background-image: url('images/".$hb1['img_name']."');\" >"; ?>

Can you try this :

<?php
$inlineImagePath = "background-image: url('images/".$hb1[img_name]."')";
 echo '<div style="$inlineImagePath"; />'
?>