为什么我的Xampp Apache服务器不能打开一个PHP脚本



我一直在写一个HTML页面,我将在下面发布它,还将发布一个PHP脚本。但是当我使用HTML页面来编写信息并提交它时;在此服务器上找不到请求的URL"消息中,我将所有文件放在htdocs上的一个名为"的文件夹中;html";,html页面被命名为";索引";并且该脚本被命名为";测试";,非常感谢您抽出时间。

[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脚本

<?php
$handle = fopen("pruebapracticaHE.txt", "a"); 
foreach($_POST as $variable => $value) {
fwrite($handle, $variable);
fwrite($handle, "=");
fwrite($handle, $value);
fwrite($handle, "rn");
}
fwrite($handle, "rn");
fclose($handle);
exit
?>

您说过脚本名称是test.php

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

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

最新更新