【发布时间】:2013-04-12 00:49:44
【问题描述】:
我有一个文件“header.php”,其中有一个搜索文本框。另一个名为“myPage.php”的文件包括“header.php”。 在 header.php 中
if (isset($_POST['Searchbutton'])){ // this will execute when the search button is clicked.
$target = $_POST['searchtext'];
header("Location: searchresult.php?text=" . $target); // line #8
}
在 myPage.php 中
<?php
include("header.php");
?>
当我在“myPage.php”上并使用搜索选项时,我收到一条错误提示
Cannot modify header information - headers already sent by (output started at myPage.php:3) in header.php on line 8.
谁能帮我理解这个概念。我是php的新手。请询问是否需要更多信息。
干杯!
【问题讨论】:
-
在使用
header()之前不要输出任何东西