簡體   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