Home > Backend Development > PHP Problem > How to determine domain name jump in php

How to determine domain name jump in php

藏色散人
Release: 2023-03-14 09:28:02
Original
3300 people have browsed it

php method to determine domain name jump: 1. Create a PHP sample file; 2. Read the visiting domain name; 3. Through "if($url == 'www.web.cn'){. ..}" method to determine the domain name and jump to different pages.

How to determine domain name jump in php

The operating environment of this article: Windows 7 system, PHP version 7.4, DELL G3 computer

php How to determine domain name jump?

PHP reads the visiting domain name and determines to redirect to a different page

The code is as follows:

<?php
$url = $_SERVER[&#39;HTTP_HOST&#39;];
if($url == &#39;www.web.cn&#39;){
echo"<script>window.location.href=&#39;http://www.web.cn/web&#39;;</script><a href=&#39;http://www.web.cn/web&#39;>如果系统长时间没有跳转界面请手动点击这里</a>";
}else if($url == &#39;www.bbs.cn&#39;){
echo"<script>window.location.href=&#39;http://www.bbs.cn/bbs&#39;;</script><a href=&#39;http://www.bbs.cn/bbs&#39;>如果系统长时间没有跳转界面请手动点击这里</a>";
}else{
echo "地址错误";
}
?>
Copy after login

Recommended learning: "PHP Video Tutorial

The above is the detailed content of How to determine domain name jump in php. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
php
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Latest Issues
php data acquisition?
From 1970-01-01 08:00:00
0
0
0
PHP extension intl
From 1970-01-01 08:00:00
0
0
0
How to learn php well
From 1970-01-01 08:00:00
0
0
0
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template