Quantcast
Channel: Active questions tagged html - Stack Overflow
Viewing all articles
Browse latest Browse all 72443

Call server_name in img src correctly

$
0
0

trying to get my head around if I can call the $_SERVER['SERVER_NAME'] in an imgsrc somehow on a PHP page. I'm trying to achieve the following:

<?php 
$domain = $_SERVER['SERVER_NAME'];
$dir = '/content/images/';
?>
<html lang="en">
<body>

<img src="<? echo 'https://',$domain,$dir,'logo.png' ; ?>">

Alternatively (if possible)
<img src="<? echo 'https://',$_SERVER['SERVER_NAME'],$dir,'logo.png' ; ?>">

</body>
</html>

I have searched around and tried different ways but can't seem to get it right. Is it possible?


Viewing all articles
Browse latest Browse all 72443

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>