我有一个运行良好的站点,但只需刷新主页 (index_3.php),我的错误日志就会填充两个警告。
[08-Oct-2013 11:36:09] PHP Warning: session_start() [<a href='function.session-start'>function.session-start</a>]: Cannot send session cache limiter - headers already sent (output started at /home2/mysite/public_html/mysubsite/index_3.php:7) in /home2/mysite/public_html/mysubsite/functions.php on line 12
[08-Oct-2013 11:36:09] PHP Warning: session_regenerate_id() [<a href='function.session-regenerate-id'>function.session-regenerate-id</a>]: Cannot regenerate session id - headers already sent in /home2/mysite/public_html/mysubsite/functions.php on line 13
我已经进行了足够的研究以了解在会话开始之前某些东西正在发送页面数据,但我似乎无法根除原因。functions.php 直接取自本教程站点的“创建 PHP 函数”。 http://www.wikihow.com/Create-a-Secure-Login-Script-in-PHP-and-MySQL
在 index_3.php 上加载的还有 get_opwire.php,它只是放置一个表格。get_opwire.php 的开头如下所示:
<?php
include 'db_connect.php';
include 'functions.php';
sec_session_start();
sec_session_start();
是位于 functions.php 中的自定义会话开始
当我尝试将 sec_session 的顺序重新排列到顶部或将它们移动到桌子周围时。Index_3.php 只是主页,主要是包含提交表单和 get_opwire.php 的 html
有人能帮我指出问题吗?
编辑:index_3.php(从第 1 行到第 1 行)
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=Windows-1252"/>
<meta name="Generator" content="Xara HTML filter v.6.0.1.335"/>
<meta name="XAR Files" content="index_htm_files/xr_files.txt"/>
<title>index_3</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0"/>
<link rel="stylesheet" type="text/css" href="index_htm_files/xr_main.css"/>
<link rel="stylesheet" type="text/css" href="index_htm_files/xr_text.css"/>
<link rel="stylesheet" type="text/css" href="index_htm_files/custom_styles.css"/>
<script type="text/javascript" src="index_htm_files/roe.js"></script>
<!--[if IE]><script type="text/javascript" src="index_htm_files/prs.js"></script><![endif]--><!--[if !IE]>--><script type="text/javascript" src="index_htm_files/prs3.js"></script><!--<![endif]-->
<script type="text/javascript">var xr_nextpage=""; var xr_transition=0; var xr_transitiontime=0;var xr_prevpage="index_2.htm"; var xr_btransition=0; var xr_btransitiontime=500;</script>
<style type="text/css">.xr_pbd {position: absolute; border:none; left: 50%; margin-left: -380px;}</style>
</head>
编辑 2:index_3.php 内的某处
<html>
<body>
<div style="width: 480px; height: 175px; overflow: auto;">
<?php include 'get_opwire.php'; ?>
</div>
</body>
</html>