Home >php教程 >php手册 >php页面跳转代码 输入网址跳转到你定义的页面

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

WBOY
WBOYOriginal
2016-06-06 20:32:011025browse

我先判断一下你是否开启了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页面,如果没有开始则跳转到项目的目录下面
Statement:
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