Cheney 发表于 2011-10-19 10:17:33

写在head标签里的内容跑到body标签里去了!!

本帖最后由 Cheney 于 2011-10-19 10:23 编辑

head.php------------------------------------------------------------
<!DOCTYPE html>
<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
    <title>FrundVC</title>
    <link rel="stylesheet" type="text/css" href="<?php echo base_url()?>application/css/init.source.css" />
    <script src="<?php echo base_url()?>application/js/base/sea.js"></script>
</head>
<body>
<div id="head"></div>
<div id="main">

index.php-------------------- -------------------- --------------------
<?php $this->load->view('head.php'); ?>
。。。
</div>
<div id="foot"></div>
</body></html>

结果index.php输出的HTML居然是:
<html>
<head>
</head>
<body>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
    <title>FrundVC</title>
    <link rel="stylesheet" type="text/css" href="http://localhost:8021/fundvc/application/css/init.source.css">
    <script src="http://localhost:8021/fundvc/application/js/base/sea.js"></script>
<div id="head"></div>
<div id="main">
。。。
</div>
<div id="foot"></div>
</body></html>
# 把head.php去掉,内容直接放在index.php里就不会出现这个问题了~~~





baiyuxiong 发表于 2011-10-19 17:16:37

出现怪异问题,一般都是低级错误引起的。

Cheney 发表于 2011-10-20 20:37:38

问题已解决,事实证明不是低级错误,ls不要妄自揣测,讲话要踏实。

是编码问题,UTF8带BOM后就这样了,而且在firefox下不会出错
页: [1]
查看完整版本: 写在head标签里的内容跑到body标签里去了!!