繁体   English   中英

动态网页

[英]Dynamic Web page

我按照本指南使用 PHP 创建动态网页。 但是由于某种原因,当我尝试导航到其中一个页面时,我收到一条错误消息:找不到对象! 在此服务器上找不到请求的 URL。 引用页面上的链接似乎有误或已过时。 请将该错误告知该页面的作者。 enter code here

我的 index.php

<title>Dynamic WebSite With PHP</title>
<style type="text/css">
@font-face
{
    src:url(asset/font.otf);
    font-family: myfont;
}
#uni
{
    position: absolute;
    width: 100%;
    min-height:100%;
    left: 0px;
    top: 0px%;
    font-family: myfont;

}
#header
{
    width: 94%;
    padding: 3%;
    font-size: 60px;
    color: white; 
    background: #a8480c;
}
#menubar
{
    width: 100%;
    background:#1f1a16;

}
#menubar a
{
    font-size: 24px;
    color:white;
    padding: 10px 20px 10px 20px;
    text-decoration: none;
    display: inline-block;

}
#menubar a:hover
{
    color: #727272;
    background: white;
}
#footer
{
    width: 94%;
    padding: 3%;
    color: white;
    background:#1f1a16;
    font-size: 24px;

}
#content
{
    width: 96%;
    padding: 2%;
    font-size: 20px;
    background-color: white;
    height: 500px;

}
</style>
<div id="uni">
<?php 
include('header.php');
?>
<div id="content">
    <?php
      if(isset($_GET['page'])) 
      {
        $page= $_GET['page'];
        $display=$page.'.php';
        include($display);
      }
      else
      {
        echo 'Hi, Welcome to my page! ';
      };
    ?>

</div>
<?php 
include('footer.php');
?>
</div>

还有我的 header.php:

<div id='header'>Header</div>

<div id="menubar">
    <a href="index.php">Home</a>
    <a href="index?page=about">About</a>
    <a href="index?page=downloads">Downloads</a>
    <a href="index?page=contact">Contact Us</a>
</div>

只需在 header.php 中添加.php扩展名:

<div id='header'>Header</div>

<div id="menubar">
    <a href="index.php">Home</a>
    <a href="index.php?page=about">About</a>
    <a href="index.php?page=downloads">Downloads</a>
    <a href="index.php?page=contact">Contact Us</a>
</div>

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM