首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >基于文本的不能工作的冒险游戏href不能工作php

基于文本的不能工作的冒险游戏href不能工作php
EN

Stack Overflow用户
提问于 2020-11-03 11:31:46
回答 1查看 20关注 0票数 0

我正在尝试制作一个基于文本的冒险游戏,但当你按下网站上的任何一个按钮时,它会被重定向为错误,我不知道这是为什么

https://icsprogramming.ca/2020-2021/luu4e5ab/activity-2-3c.php/

代码语言:javascript
复制
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="utf-8">
    
    <title>Text-based Adventure Game</title>    
    
    <meta name="description" content="Text-based Adventure Game using PHP">
    <meta name="author" content="kl">   
    
    <!-- styles - internal (not linked) -->
    <style>
        body {
            padding: 20px 20px 20px 20px;
            background-color: #ececec; 
            color: #333333;
            font-family: "Century Gothic", CenturyGothic, AppleGothic, sans-serif;
        }
    </style>

</head>
<body>
    <h1>CYOA Text-based Game: Simple</h1>
    <p>Choose wisely!</p>
    
<?php
    $option = $_GET['option'];
    
    if ($option == "") {
        echo "<p>You are standing in a dark room with 2 doors.  One to the left and one to the right.  You must make a choice.
        <br /><a href='text-based-cyoa-example.php?option=1'>LEFT DOOR</a> | <a href='text-based-cyoa-example.php?option=2'>RIGHT DOOR</a>
        </p>";
    } else if ($option == "1") {
        echo "<p>You chose the left door.  Very wise.  The door shuts behind you and locks.  You are standing in another room.  There are two tunnels leading out of the room.<br />
        <a href='text-based-cyoa-example.php?option=3'>LEFT TUNNEL</a> | <a href='text-based-cyoa-example.php?option=4'>RIGHT TUNNEL</a>
        </p>";
    } else if ($option == "2") {
        echo "<p>You have parished. Sorry.<br /><a href='text-based-cyoa-example.php'>START AGAIN</a></p>";
    } else if ($option == "3") {
        echo "<p>You have parished. Sorry.<br /><a href='text-based-cyoa-example.php'>START AGAIN</a></p>";
    } else if ($option == "4") {
        echo "<p>You have parished. Sorry.<br /><a href='text-based-cyoa-example.php'>START AGAIN</a></p>";
    } else {
        echo "<p>You have made an invalid selection!</p>";                
            }
?>
    
</body>
</html>```
EN

回答 1

Stack Overflow用户

发布于 2020-11-03 11:44:35

嗨,我想你已经你只是把你的HREF放在链接标签里了。浏览一下,就会发现没有text-based-cyoa-example.php文件

我认为你想要导航到:https://icsprogramming.ca/2020-2021/luu4e5ab/activity-2-3c.php/?option=1

或者最好保持事物的相对,这样你就可以使用像这样的东西:

代码语言:javascript
复制
<a href="/?option=1">Left Door</a><a href="/?option=2">Right Door</a>
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/64656443

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档