【问题标题】:Why my Xampp Apache server cant open one PHP script?为什么我的 Xampp Apache 服务器无法打开一个 PHP 脚本?
【发布时间】:2022-01-11 20:50:16
【问题描述】:

我一直在写一个 HTML 页面,我会在下面放一个,我也会发布一个 PHP 脚本。但是当我使用 HTML 页面编写信息并提交时,我得到“在此服务器上找不到请求的 URL”。消息,我将所有文件放在名为“html”的 htdocs 上的一个文件夹中,html 页面名为“index”,脚本名为“test”,非常感谢您的宝贵时间。

[HTML 代码]

<!doctype html>
<html lang="en">
  <head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
    <meta name="description" content="">
    <meta name="author" content="">
    <link rel="icon" href="/docs/4.0/assets/img/favicons/favicon.ico">

    <title>Signin Template for Bootstrap</title>

    <link rel="canonical" href="https://getbootstrap.com/docs/4.0/examples/sign-in/">

    <!-- Bootstrap core CSS -->
    <link href="../../dist/css/bootstrap.min.css" rel="stylesheet">

    <!-- Custom styles for this template -->
    <link href="signin.css" rel="stylesheet">
  </head>

  <body class="text-center">
    <form method="post" action="next.php">
      <img class="mb-4" src="https://getbootstrap.com/docs/4.0/assets/brand/bootstrap-solid.svg" alt="" width="72" height="72">
      <h1 class="h3 mb-3" font-weight="normal"> Please sign in </h1>
      <label for="inputEmail" class="sr-only">Email address</label>
      <input type="email" id="inputEmail" class="form-control" placeholder="Email address" required autofocus>
      <label for="inputPassword" class="sr-only">Password</label>
      <input type="password" id="inputPassword" class="form-control" placeholder="Password" required>
      <div class="checkbox mb-3">
        <label>
          <input type="checkbox" value="remember-me"> Remember me
        </label>
      </div>
        <button class="btn btn-lg btn-primary btn-block" type="submit">Sign in</button>
        <p class="mt-5 mb-3 text-muted">&copy; 2017-2018</p>
    </form>
  </body>
</html>

PHP script

<?php

$handle = fopen("pruebapracticaHE.txt", "a"); 

foreach($_POST as $variable => $value) {

    fwrite($handle, $variable);

    fwrite($handle, "=");

    fwrite($handle, $value);

    fwrite($handle, "\r\n");
}

fwrite($handle, "\r\n");
fclose($handle);

exit
?>

【问题讨论】:

  • Never post images of code, data or error messages。请编辑您的问题并将文本复制/粘贴到问题中,格式化。这样我们就可以尝试重现问题而无需重新输入所有内容,并且屏幕阅读器可以正确索引或阅读您的问题。

标签: php html apache xampp


【解决方案1】:

你说脚本名称是test.php

但是我可以在您的 HTML 代码中看到您在表单中设置 action="next.php" 而不是 action="test.php" 正确的代码是:

<form method="post" action="test.php">

【讨论】:

  • 对不起,这是我的错误,脚本被命名为next.php,我很累哈哈,这么多
  • 你确定你的脚本和html文件在同一个路径吗? @AlexUsed
猜你喜欢
  • 1970-01-01
  • 2016-10-13
  • 2013-03-25
  • 2015-07-03
  • 2020-02-01
  • 1970-01-01
  • 2016-04-19
  • 2018-06-18
  • 2020-08-12
相关资源
最近更新 更多