php - 了解缓存限制器 | header 已发送 php 警告

标签 php mysql session header connect

我有一个运行良好的站点,但只需刷新主页 (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

我已经进行了足够的研究以了解在 session 开始之前某些东西正在发送页面数据,但我似乎无法根除原因。 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 中的自定义 session 开始

当我尝试将 sec_session 的顺序重新排列到顶部或将它们移动到 table 周围时。 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> 

最佳答案

尝试删除关闭 ?>来自所有包含的 php 文件的标记。

关于php - 了解缓存限制器 | header 已发送 php 警告,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19254817/

相关文章:

php - 我可以使用 PHP、MySQL 和 Javascript 在我的网站上创建即时消息系统吗?

php - body 图像定位与 body

php - 内联MySQL图片展示

PHP session 过期

Java 小服务程序 : How can I encode url as if SessionTrackingMode would be URL?

php - 查询数据库中某个区域的位置

php - undefined index 错误,文件中存在多个数据库连接

ruby - 尝试使用 Rails 4.0.0 设置 ROR 环境,但 Webrick Webserver 无法运行 uaing Rails

mysql - 我应该索引哈希吗?

php - PHP 中正确的 session 劫持预防