警告:无法修改标头信息 - 已经发送的标头(/srv/disk3/1618233/www/netdisk.co.nf/mojprofil.php:27上的输出)/ srv / disk3 / 1618233 /第18行的www / netdisk.co.nf / classes / Redirect.php
所以这个错误我尝试了很多东西,但我想出来的想法尽快解决
mojprofil.php:
<?php
session_start();
require_once 'core/init.php';
?>
<html>
<head>
<meta charset="UTF-8">
<title>Domov</title>
<link rel="stylesheet" type="text/css" href="Styles/Stylesheet.css" />
</head>
<body>
<div id="wrapper">
<div id="banner">
</div>
<nav id="navigation">
<ul id="nav">
<li><a href="index.php">Domov</a></li>
<li><a href="mojprofil.php">Moj profil</a></li>
<li><a href="#">Pomoč</a></li>
<li><a href="kontakt.php">Kontakt</a></li>
</ul>
</nav>
<div id="content_area">
<?php
require_once 'core/init.php';
if(Session::exists('home')) {
echo '<p>' . Session::flash('home') .'</p>';
}
$user = new User();
if (!$user->IsLoggedIn()) {
include 'login.php';
ob_end_flush();
?>
<p>
Če nimate računa pritisnite<a href="register.php">TUKAJ</a>.
</p>
<?php
session_start();
} else {
}
?>
</div>
<div id="sidebar">
<?php
include 'index_2.php';
?>
</div>
<footer>
<p>Vse pravice pridržane.</p>
</footer>
</div>
</body>
</html>
和redirect.php:
<?php
session_start();
?>
<?php
class Redirect {
public static function to($location = null) {
if($location) {
if(is_numeric($location)) {
switch($location) {
case 404;
header('HTTP/1.0 404 Not Found');
include 'includes/errors/404.php';
exit();
break;
}
}
header('Location: ' . $location);
exit();
}
}
}
?>
答案 0 :(得分:-1)
在页面顶部添加@ob_start()
。