Home > php教程 > php手册 > body text

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

WBOY
Release: 2016-06-06 20:32:01
Original
1011 people have browsed it

我先判断一下你是否开启了https,如果是就正常的https页面,如果没有开始则跳转到项目的目录下面,感兴趣的朋友可以参考下哈,希望对你有所帮助

代码很简单,涉及到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 Recommendations
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template