我之前发布了一些事情,这次我将发布所有内容。我收到错误消息,当我尝试在本地主机上启动时它不会显示。 这是代码:
这是includeindex.php
if ($_POST['submit'] != "") {
if ($_POST['name'] != "") {
session_start();
$_SESSION['name'] = $_POST['name'];
TopNavigation("PHP Includes Example - ECA236", "PHP Includes", $_SESSION['name']);
} else {
header("Location:includindex.php");
exit;
}
} else {
TopNavigation("PHP Includes Example - ECA236", "PHP Includes");
echo "<div class=\"formtable\">\n";
echo "<br>";
echo "<form action=\"" . $PHP_SELF . "\" method=\"post\">\n";
echo "Please enter your name:<input type=\"text\" name=\"name\">\n";
echo "<input type=\"submit\" class=\"btnSubmit\" value=\"Enter\" name=\"submit\">\n";
echo "</form>\n";
echo "<br>";
echo "</div>\n";
Footer();
}
?>
这是标题
<?php
function TopNavigation($pagetitle, $pageheading, $username = '') {
echo "<html>\n";
echo " <head>\n";
echo " <title>" . $pagetitle . "</title>\n";
echo " <link href=\"../style.css\" type=\"text/css\" rel=\"stylesheet\">";
echo " </head>\n";
echo " <body>";
echo " <h1>" . $pageheading . "</h1>\n";
echo " <hr>\n";
echo " <p class=\"tiny\">" . date("F j,Y") . "</p>";
if ($username != '') {
echo "<div align=\"center\">\n";
echo "<a href=\"includeindex.php\">Use a different name</a> | <a href=\"about.php\">About</a> | <a href=\"signout.php\">Signout</a>\n";
echo "</div>\n";
echo "<p>Welcome. " . $username . "!";
}
}
function Footer() {
echo "</body>\n";
echo "</html>\n";
}
?>
这是about.php
<?php
session_start();
include("include/header.php");
if (!isset($_SESSION['name'])) {;
header("Location:includeindex.php");
exit;
} else {
TopNavigation("About Me -ECA236", "About Me", $_SESSION['name']);
echo "<p>Here is a little about me. I am a mother of twin girls who are 9 </p>\"n;
echo " < p>I been married for 5 years but been with my husband for 11 years </p > \"n;
echo "<p > I am attending college for Computer Programming and Database Mangament </p > \"n;
echo "<p > After I get done with this degree I am want to go back for Web Design </p > \"n;
echo "<p > since half my classes are web design now . I enjoy camping,bon fires and </p > \"n;
echo "<p > playing video games, hanging out with friends and family .</p > \"n;
Footer();
}
?>
这是signout.php
<?php
session_start();
if (isset($_SESSION['name'])) {
session_destroy();
session_start();
}
header("Location:includeindex.php");
exit;
?>
我无法让它显示和工作。我不知道为什么不这样做。有人可以帮助我。
无论我修复了什么,我都会一直收到错误,当你在网上查看它时,它不会出现..
这里我得到的错误: 注意:未定义的变量:第19行的C:\ wamp \ www \ includeindex.php中的PHP_SELF 未定义的索引:在第4行的C:\ wamp \ www \ includeindex.php中提交 警告:include(include / header.php)[function.include]:无法打开流:第3行的C:\ wamp \ www \ about.php中没有这样的文件或目录 警告:include()[function.include]:在第3行的C:\ wamp \ www \ about.php中打开'include / header.php'以包含(include_path ='。; C:\ php \ pear')失败 致命错误:在第9行的C:\ wamp \ www \ about.php中调用未定义的函数TopNavigation()
答案 0 :(得分:0)
echo
函数中的所有TopNavigation()
语句仍然被错误引用。它们不应以\"n;
代替\n";
// Wrong
echo "<p>Here is a little about me. I am a mother of twin girls who are 9 </p>\"n;
// Should be:
echo "<p>Here is a little about me. I am a mother of twin girls who are 9 </p>\n";
---^^^^
答案 1 :(得分:0)
更改display_errors = Off to display_errors = On