我已经定义了 2 个变量,联系人和衬衫。如您所见,它们也在标题中的 li 中。我仍然收到两个变量都未定义的消息。
我收到此错误消息:
( ! ) SCREAM: ( ! ) 忽略错误抑制
注意:未定义变量:第 17 行 C:\wamp\www\Test\shirts4mike\inc\header.php 中的部分
调用堆栈#TimeMemoryFunctionLocation 10.0003243592{main}( )..\index.php:0
20.0006246920 包括('C:\wamp\www\Test\shirts4mike\inc\header.php')..\index.php:3 ">
第 18 行也是如此。
衬衫.php:
<?php
$pageTitle = "Mike's Full Catalog of Shirts";
$section = "shirts";
include('inc/header.php'); ?>
<div class="section page">
<h1>Mikes’s Full Catalog of Shirts</h1>
</div>
<?php include ('inc/footer.php'); ?>
联系人.php:
<?php
$pageTitle = "Contact Mike";
$section = "contact";
include('inc/header.php'); ?>
<div class="section page">
<h1>Contact</h1>
</div>
<?php include ('inc/footer.php'); ?>
header.php:
<html>
<head>
<title> <?php echo $pageTitle ?></title>
<link rel="stylesheet" href="css/style.css" type="text/css">
<link rel="stylesheet" href="http://fonts.googleapis.com/css?family=Oswald:400,700" type="text/css">
<link rel="shortcut icon" href="favicon.ico">
</head>
<body>
<div class="header">
<div class="wrapper">
<h1 class="branding-title"><a href="./">Shirts 4 Mike</a></h1>
<ul class="nav">
<li class="shirts <?php if ($section == "shirts"){ echo "on"; } ?>"><a href="shirts.php">Shirts</a></li>
<li class="contact <?php if ($section == "contact"){ echo "on"; } ?>"><a href="contact.php">Contact</a></li>
<li class="cart"><a href="#">Shopping Cart</a></li>
</ul>
</div>
</div>
<div id="content">