How to set up the same website, different domain names, and different background images?
小蓝
小蓝 2023-06-22 17:41:26
0
2
475

Dear brothers. Excuse me, I am a novice. I have bound multiple domain names to the same web page. For example, if I want www.bd.com to access it, the background image should be changed to b.jpg. Otherwise, the default is the background image set before

小蓝
小蓝

reply all(2)
小蓝

thank you boss

WBOY

<?php
$domain = $_SERVER['HTTP_HOST'];

if ($domain == 'www.bd.com') {
$backgroundImage = 'b.jpg';
} else {
$backgroundImage = 'default.jpg'; // 默认背景图
}
?>

<!DOCTYPE html>
<html>
<head>
<style>
body {
background-image: url(<?php echo $backgroundImage; ?>);
}
</style>
</head>
<body>
<!-- 页面内容 -->
</body>
</html>

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!