下面是我的php include代码。我想我正在输入正确的代码,但它似乎并没有遵守:
这是我的headertop.php:
'<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>
<head>
<title>HOME</title>
<meta http-equiv="content-type" content="text/html; charset=UTF-8"/>
<meta name="description" content="Slide Down Box Menu with jQuery and CSS3" />
<meta name="keywords" content="jquery, css3, sliding, box, menu, cube, navigation,
portfolio, thumbnails"/>
<link rel="shortcut icon" href="images/art_favicon.png" type="image/x-
icon"/>
<link rel="stylesheet" href="css/style.css" type="text/css" media="screen"/>
</head>
<header>
<?php
<div id="headertop">
<div id="adams">
<p><span style="color: #F60;">A</span>ncajas <span style="color:
#F60;">D</span>igital <span style="color: #F60;">A</span>rts & <span style="color:
#F60;">M</span>edia <span style="color: #F60;">S</span>olutions</p>
</div>
</div>
?>
</header>
</head>
</html>'
这是我的index.php:
'<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>
<head>
<title>HOME</title>
<meta http-equiv="content-type" content="text/html; charset=UTF-8"/>
<meta name="description" content="Slide Down Box Menu with jQuery and CSS3" />
<meta name="keywords" content="jquery, css3, sliding, box, menu, cube, navigation,
portfolio, thumbnails"/>
<link rel="shortcut icon" href="images/art_favicon.png" type="image/x-
icon"/>
<link rel="stylesheet" href="css/style.css" type="text/css" media="screen"/>
<style>
body{
background-image: url(images/graphy.png);
font-family:Arial, Helvetica, sans-serif;
margin: 0;
padding: 0;
}
</style>
</head>
<header>
<?php
include ('headertop.php');
?>
</header>
<body>
<div id="contents">
</div>
</body>
</html>'
当然我的CSS是标题部分:
'#headertop{
width: 1050px;
height: auto;
background-color: #252525;
margin-left: auto;
margin-right: auto;
position: inherit;
border-top: solid #F60 2px;
margin-bottom: 0px;
/*border-bottom: solid #F60 1px;*/
}
#adams{
font-family:"Trajan Pro";
font-weight: 100;
font-size: 24px;
text-align: center;
color: #CCC;
padding-bottom: 6px;
margin-bottom: 17px;
}
header{
width: 1050px;
height: 300px;
/*background-image:url(../interactive/product_slideshow.swf);*/
/*background-color: #999;*/
margin-left: auto;
margin-right: auto;
}'
谢谢大家的支持。
答案 0 :(得分:0)
这应该是一个错误:
<?php
<div id="headertop">
在headertop.php
之内。此外,我建议您在编码时使用turn errors on,这样就不会再发生了。
您不需要在您包含的文件中设置完整的html,只需要包含您要包含的位。尝试将headertop.php
更改为:
<div id="headertop">
<div id="adams">
<p>
<span style="color: #F60;">A</span>ncajas
<span style="color: #F60;">D</span>igital
<span style="color: #F60;">A</span>rts &
<span style="color: #F60;">M</span>edia
<span style="color: #F60;">S</span>olutions
</p>
</div>
</div>