我收到此錯誤發送了頭:警告:在session_start():不能發送會話cookie - 已經由
Warning: session_start(): Cannot send session cookie - headers already sent by
的index.php
<!-- Session Section -->
<?php include 'core/session.php'; ?>
<!-- Header Section -->
<?php include 'include/header.php'; ?>
<!-- Navigation Section -->
<?php include 'include/navigation_without_logged.php'; ?>
<!-- Content Section -->
<?php include 'include/index_content.php'; ?>
<!-- Footer Section -->
<?php include 'include/footer.php'; ?>
session.php文件
<?php
if(session_status()!=PHP_SESSION_ACTIVE) {
session_start();
}
error_reporting(0);
//finding the page the user is currently on
$current_page = end(explode('/', $_SERVER['SCRIPT_NAME']));
?>
header.php
<!DOCTYPE html>
<html lang="en">
<head>
<title>TEST</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta charset="utf-8">
<meta name="keywords" content="Electrician Responsive web template, Bootstrap Web Templates, Flat Web Templates, Android Compatible web template,
Smartphone Compatible web template, free webdesigns for Nokia, Samsung, LG, SonyEricsson, Motorola web design" />
<script type="application/x-javascript"> addEventListener("load", function() { setTimeout(hideURLbar, 0); }, false); function hideURLbar(){ window.scrollTo(0,1); } </script>
<!-- bootstrap-css -->
<link href="assets/css/bootstrap.css" rel="stylesheet" type="text/css" media="all" />
<!--// bootstrap-css -->
<!-- css -->
<link rel="stylesheet" href="assets/css/style.css" type="text/css" media="all" />
<link rel="stylesheet" href="assets/css/flexslider.css" type="text/css" media="screen" property="" />
<!--// css -->
<!-- font-awesome icons -->
<link rel="stylesheet" href="assets/css/font-awesome.min.css" />
<!-- //font-awesome icons -->
<!-- font -->
<link href="//fonts.googleapis.com/css?family=Josefin+Sans:100,100i,300,300i,400,400i,600,600i,700,700i" rel="stylesheet">
<link href='//fonts.googleapis.com/css?family=Roboto+Condensed:400,700italic,700,400italic,300italic,300' rel='stylesheet' type='text/css'>
<!-- //font -->
<script type="text/javascript" src="assets/js/jquery-2.1.4.min.js"></script>
<script src="assets/js/main.js"></script>
<!--[if lt IE 9]>
<script src="https://oss.maxcdn.com/libs/html5shiv/3.7.0/html5shiv.js"></script>
<![endif]-->
</head>
這是我得到的錯誤:
Warning: session_start(): Cannot send session cookie - headers already sent by (output started at /home/jomingeo/public_html/tradeschool/index.php:2) in /home/jomingeo/public_html/tradeschool/core/session.php on line 9
Warning: session_start(): Cannot send session cache limiter - headers already sent (output started at /home/jomingeo/public_html/tradeschool/index.php:2) in /home/jomingeo/public_html/tradeschool/core/session.php on line 9
任何幫助將受到歡迎,我希望我所描述的不足的問題,如果不是請你,我可以分享更多的信息。 在此先感謝:)
的可能的複製[如何修復「頭已發送」錯誤在PHP中](http://stackoverflow.com/questions/8028957/how-to-fix-headers-already-sent-error-in-php) –
我已經看過其他地方之前,我張貼但我似乎無法解決問題 –