Home > Backend Development > PHP Tutorial > php页面跳转代码 输入网址跳转到你定义的页面_PHP

php页面跳转代码 输入网址跳转到你定义的页面_PHP

WBOY
Release: 2016-06-01 12:07:54
Original
788 people have browsed it

代码很简单,涉及到header函数的使用,代码如下
复制代码 代码如下:
if (!empty($_SERVER['HTTPS']) && ('on' == $_SERVER['HTTPS'])) {
$uri = 'https://';
} else {
$uri = 'http://';
}
$uri .= $_SERVER['HTTP_HOST'];
header('Location: '.$uri.'/demo/');
exit;
?>

代码解释 :我先判断一下你是否开启了https,如果是就正常的https页面,如果没有开始则跳转到项目的目录下面

Related labels:
source:php.cn
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template