本文介绍了PHP标头不起作用(GoDaddy)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在尝试创建登录页面,但似乎无法显示标题.
I am trying to make a login page but I can't seem to get the header to show up.
session_start();
$_SESSION['prevURL'] = $_SERVER['REQUEST_URI'];
if(!$_SESSION['set'])
{
header("location: main_login.php");
}
推荐答案
根据您的评论.您不能在Session_start()之前显示(打印,回显)HTML.
Based on your comment. You cannot show (print, echo) HTML before the Session_start();
<!DOCTYPE html>
<html>
<?php
session_start();
$_SESSION['prevURL']=$_SERVER['REQUEST_URI'];
//make this $_SESSION[ 'adminSet'] if it 's an admin-only page
if(!isset($_SESSION['set'])) {
header("location: main_login.php"); }
?>
<head>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js"> </script>
<script src="/bootstrap/js/bootstrap.js"> </script>
<script src="/bootstrap/js/bootstrap.min.js"> </script>
应更改为此:
<?php
session_start();
$_SESSION['prevURL']=$_SERVER['REQUEST_URI'];
//make this $_SESSION['adminSet'] if it 's an admin-only page
if(!isset($_SESSION['set'])) {
header("location: main_login.php"); }
?>
<!DOCTYPE html>
<html>
<head>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js"> </script>
<script src="/bootstrap/js/bootstrap.js"> </script>
<script src="/bootstrap/js/bootstrap.min.js"> </script>
这篇关于PHP标头不起作用(GoDaddy)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!