简体   繁体   中英

PHP in Background-image tag

On a Wordpress theme site I have this code:

<div class="gallery-img" style="background-image: url(<?php echo esc_url($image['sizes']['thumbnail']); ?>);">

However I need the background image url to be in ''.

So it works like this:

<div class="gallery-img" style="background-image: url('<?php echo esc_url($image['sizes']['thumbnail']); ?>');">

With it like that the PHP then does not work, how can I do the above so it works and so it has the '' around it?

如何反转你的单引号和双引号?

<div class="gallery-img" style='background-image: url("<?php echo esc_url($image['sizes']['thumbnail']); ?>");'>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM