【发布时间】:2015-02-20 19:25:26
【问题描述】:
我一直在做一个网站,我们被要求加入 php,并使用页眉/页脚。我的工作没有错误,除了“未完成错误的头部结束标签”我已经将头部的结束标签移动到整个地方并且无法弄清楚为什么它仍然会抛出错误。验证时如何解决这个愚蠢的错误
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link rel="stylesheet" type="text/css" href="../seltzerr/css/webd2201.css" />
<!--
Author: Ryan Seltzer
Filename: header.php Date: 2015-02-19 Description: This file is the header for all of my web pages, it includes the styling of the page, colors, banner and all of the links to my other web pages
and will be implemented on future assignments as well.-->
</head>
<body>
<div id="container">
<div id="header">
<a href="http://www.durhamcollege.ca">
<img src="./images/dclogo.jpg" alt="Durham College Logo"/>
</a>
<h1>
Ryan Seltzer's Website
</h1>
</div>
<div id="sites">
<ul>
<li><a href="http://opentech.durhamcollege.ca/~pufferd/intn2201/">INTN2201</a></li>
<li><a href="http://www.w3schools.com">W3Schools</a></li>
<li><a href="http://validator.w3.org">XHTML Validator</a></li>
<li><a href="http://jigsaw.w3.org/css-validator/">CSS Validator</a></li>
<li><a href="http://php.net/manual/en/index.php">PHP Manual</a></li>
<li><a href="http://www.durhamcollege.ca">Durham College</a></li>
</ul>
</div>
<div id="content-container">
<div id="navigation">
<h3>
Navigation Bar
</h3>
<ul>
<li><a href="../seltzerr/index.php">Home Page</a></li>
<li><a href="../seltzerr/lab1.php">Lab 1: Basic XHTML pages</a></li>
<li><a href="../seltzerr/lab2.php">Lab 2: Working with HTML Tables</a></li>
<li><a href="../seltzerr/lab3.php">Lab 3: Formatting and Layout with Styles</a></li>
<li><a href="../seltzerr/termtest1.php">Term Test 1: Practical</a></li>
<li><a href="../seltzerr/lab4.php">Lab 4: PHP Chapter Files from textbook</a>
<ul>
<li><a href="../seltzerr/lab4phptags.php">Lab 4: PHP Start and End Tags</a></li>
<li><a href="../seltzerr/lab4firstscript.php">Lab 4: PHP Code Cohabitation</a></li>
<li><a href="../seltzerr/lab4errorscript.php">Lab 4: PHP Escaping Your Code</a></li>
<li><a href="../seltzerr/lab4errorscript2.php">Lab 4: PHP Escaping Your Code Part 2</a></li>
<li><a href="../seltzerr/lab4comments.php">Lab 4: PHP Commenting Your Code </a></li>
<li><a href="../seltzerr/lab4printvarscript.php">Lab 4: PHP Variable and Value Types</a></li>
<li><a href="../seltzerr/lab4constants.php">Lab 4: PHP Using Constants </a></li>
<li><a href="../seltzerr/lab4constants2.php">Lab 4: PHP Using Constants 2</a></li>
<li><a href="../seltzerr/lab4assignscript.php">Lab 4: PHP Assignment Operators</a></li>
<li><a href="../seltzerr/lab4comparisonscript.php">Lab 4: PHP Comparison Operators</a></li>
<li><a href="../seltzerr/lab4logicalscript.php">Lab 4: PHP Logical Operators</a></li>
</ul>
</li>
</ul>
</div>
<div id="content"><!--
Author: Ryan Seltzer
Filename: header.php Date: 2015-02-19 Description: This file is the header for all of my web pages, it includes the styling of the page, colors, banner and all of the links to my other web pages
and will be implemented on future assignments as well.-->
<h2>Ryan Seltzer's Home </h2>
<p>This page was created for the class <a href ="http://opentech.durhamcollege.ca/~pufferd/intn2201">WebD2201</a>
at <a href="http://www.durhamcollege.ca">Durham College</a> as a home page for
all of the assignments given over the course of this semester. The objective of this
website is to serve as a home page for all of the coming assignments. It will have links
to each assignment done and will follow a similar shape and feel to all assignments.</p>
<!-- end of main page content -->
</div>
<div id="footer">
<!-- start of footer -->
<a href="http://validator.w3.org/check?uri=referer">
<img style="width:88px;
height:31px;"
src="http://www.w3.org/Icons/valid-xhtml10"
alt="Valid XHTML 1.0 Strict" />
</a>
<a href="http://jigsaw.w3.org/css-validator/check/referer">
<img style="width:88px;
height:31px;"
src="http://jigsaw.w3.org/css-validator/images/vcss"
alt="Valid CSS!" />
</a>
© Ryan Seltzer, 2015
<!-- end of footer -->
</div>
</div>
</div>
</body>
</html>
【问题讨论】:
-
是什么给了你这个错误?你在哪里看到的?
-
它在 w3 验证器中显示第 11 列第 7 行
-
PHP解析完后能显示源码吗?
-
“我的工作没有错误” + “无法弄清楚为什么它仍然会抛出错误” - 你在自相矛盾。另外,
<?php $title ?>应该做什么?这只是一个处于不确定状态的变量。你的文件是.php,对吧? -
渲染时 php var $title 会产生什么?