| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 762 人关注过本帖
标题:php文件出错,网页显示有误。
取消只看楼主 加入收藏
yangfei20090
Rank: 1
等 级:新手上路
帖 子:1
专家分:0
注 册:2011-8-9
收藏
 问题点数:0 回复次数:0 
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>
搜索更多相关主题的帖子: 网站 already started modify 网页 
2011-08-09 21:04
快速回复:php文件出错,网页显示有误。
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.017432 second(s), 8 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved