php文件出错,网页显示有误。
网站顶端出现如下提示:Warning: Cannot modify header information - headers already sent by (output started at /home/aimeicom/public_html/index.php:4) in /home/aimeicom/public_html/inc/function.php on line 33
Warning: Cannot modify header information - headers already sent by (output started at /home/aimeicom/public_html/index.php:4) in /home/aimeicom/public_html/inc/function.php on line 34
function.php的代码如下:
<?php
require_once "config.php";
require_once 'Taoapi.php';
require_once 'incfunction.php';
date_default_timezone_set('Asia/Shanghai');
$read_data_num = 0;
$arr_app = getoneapp();
$Taoapi_Config = Taoapi_Config::Init();
$Taoapi_Config->setTestMode(false)
->setVersion(2)
->setAppKey($arr_app[0])
->setAppSecret($arr_app[1]);
$Taoapi = new Taoapi;
$Taoapi->Cache->setCacheTime($setCacheTime);
if((time() % 500)==0){
deldir("Apicache",$setCacheTime*60*60);
}
$url_this = "http://".$_SERVER ['HTTP_HOST'].$_SERVER['REQUEST_URI'];
if($rehost == "on"){
$the_host = $_SERVER['HTTP_HOST'];
$request_uri = isset($_SERVER['REQUEST_URI']) ? $_SERVER['REQUEST_URI'] : '';
$siteurlre = str_replace("http://","",$siteurl);
$request_uri = str_replace("index.php","",$request_uri);
if($the_host !== $siteurlre)
{
header('HTTP/1.1 301 Moved Permanently');
header('Location: '.$siteurl.$request_uri);
}
}
?>
33和34行就是最后那两个header。
中间的空白行是否要删除?
别人说了很多很专业的东西,但我看不懂,我想知道怎么改能不让这两条错误提示显示出来,谢谢。index.php的代码如下:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.
<html xmlns="http://www.
<head>
<?php require_once 'inc/source_index.php';?>
<meta http-equiv="Content-Type" content="text/html; charset=gbk" />
<meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7" />
<title><?php echo $index_title ?></title>
<meta name="keywords" content="<?php echo $index_keywords ?>" />
<meta name="description" content="<?php echo $index_description ?>" />
<link href="css/<?php echo $style?>_all.css" rel="stylesheet" type="text/css" />
<link href="css/<?php echo $style?>_index.css" rel="stylesheet" type="text/css" />
<script src="js/base64.js"></script>
<script src="js/function.js"></script>
<link rel="Shortcut Icon" href="favicon.ico">
<link rel="Bookmark" href="favicon.ico">
<!-- 兼容其他浏览器收藏夹脚本 -->
<script language="javascript">
function addfavor(url,title) {
if(confirm("网站名称:"+title+"\n网址:"+url+"\n确定添加收藏?")){
var ua = navigator.userAgent.toLowerCase();
if(ua.indexOf("msie 8")>-1){
external.AddToFavoritesBar(url,title,'');//IE8
}else{
try {
window.external.addFavorite(url, title);
} catch(e) {
try {
window.sidebar.addPanel(title, url, "");//firefox
} catch(e) {
alert("加入收藏失败,请使用Ctrl+D进行添加");
}
}
}
}
return false;
}
</script>
</head>
<body>
<?php include("template/"."$style"."/index.php");?>
</body>
</html>