【发布时间】:2009-08-04 09:56:10
【问题描述】:
我昨天问了“php 警告 - 服务器移动后已发送标头”的问题,我已经做出了更改,试图解决问题,但我仍然没有得到它!
我正在编写由另一家公司编写的代码!我没有将站点从他们的服务器上移出并将其放在我们的服务器上,但我的问题是会话无法跨新服务器上的页面工作!
我收到警告:
警告:session_start() [function.session-start]:无法发送会话 缓存限制器 - 标头已发送(输出开始于 /home/com10002/public_html/bank/index.php:28) 在 /home/com10002/public_html/bank/includes/quickform.php 在第 3 行
在我的 index.php 中
include('includes/functions.php');
$activeTab = "navhome";
$sent = false;
$title = (isset($_GET['title']))? mysql_real_escape_string($_GET['title']) : 'Home';
$title = str_replace('-',' ', $title);
if($title != '') {
$sql = "SELECT *
FROM contents
WHERE name LIKE '%$title%'
LIMIT 1";
$result = @mysql_query($sql);
$row = mysql_fetch_assoc($result);
}
//Set page title
$pagetitle = (isset($row['name']) && $title != 'Home')? ucwords($row['name']) : "Bank Charges";
HTML..HEAD..元数据和标题标签..ECT
include('includes/header.php');
<div class="textarea">
<?php include('includes/rightcol.php'); ?>
<div id="contentvideo" style="display:none;"></div>
<h1><?=$row['h1'];?></h1>
<h2><?=$row['h2'];?></h2>
<?=$row['intro'];?>
<?php include('includes/quickform.php');?>
<?=$row['page_content'];?>
</div>
<?php include('includes/subnav.php'); ?>
在 quickform.php 中
if($_POST) {
session_start();
$error = false;
$captcha = false;
$sent = false;
etc.......
这是他们的代码,目前在他们的服务器上运行良好!
1) 我尝试将session_start() 移动到index.php 的顶部
2)在两个页面上都放置一个会话。
3) 删除会话前的空白,当它在 index.php 中时
我的新版本是网站www.compensation-claims.org/bank
因为这不是我的代码,我不确定他们为什么将会话放在 quickform.php 中
【问题讨论】: