php有问题,问题是在单击submit按钮后,只有不能发布/file.php错误。我正在使用LAMPP并激活but服务器服务,我已经将我的项目放在/htdocs文件夹中,但它仍然是一样的。
这是我的代码: html
<form id="flogin" method="post" action="phpe.php"> <!--form login-->
<input id="user" name="user" placeholder="username" type="text">
<input id="pass" name="pass" placeholder="password" type="password"><br>
<input id="bf" type="submit" value="login">
</form>phpe.php:
<?php
$username="singduwe";
$password="websiteiki";
if($_POST["user"]==$username and $_POST["pass"]==$password){
session_start();
$_SESSION["admin"]="yes";
header("location:admin.php");
}else{
session_start();
$_SESSION["admin"]="no";
header("location:index.html");
}
?>admin.php:
<?php
session_start();
?>
<html>
<head></head>
<body>
hi</body>
</html>使用括号代码编辑器的更新
发布于 2014-10-20 03:14:06
给了你的代码一个快速的尝试,它的工作,如预期。也许你在你的设置中遗漏了什么?什么是准确的错误信息?
在我看来,您的not服务器没有安装PHP吗?
你是怎么安装你的灯罩的?既然您说LAMP,我假设您的服务器是linux。
请检查您的服务器上是否安装了php,如果是,Apache是否配置为使用PHP?
基于linux的安装,使用yum或apt安装是相当容易的。看看这个https://www.digitalocean.com/community/tutorials/how-to-install-linux-apache-mysql-php-lamp-stack-on-ubuntu
若要快速检查是否安装了php,请使用
<?PHP
phpinfo();
?>如果一切顺利,您应该看到一堆类似于information...something的PHP
http://i.imgur.com/L0eospD.png
您的代码非常直接,除非设置错误,否则不会失败。如果您是windows用户,请尝试本地托管的WAMP服务器;如果您不想篡改Linux,这将是有帮助的。
发布于 2014-10-20 02:55:36
你能试着把action="phpe.php"编辑成action="yourdirectory/phpe.php"吗
也许能行。如果还是一样的话,请告诉我更多的细节。
发布于 2020-08-30 23:17:58
确保您的php文件路径包含在您正在调用的代码的部分。听起来项目没有存储在默认的htdocs文件夹中。干杯
https://stackoverflow.com/questions/26457895
复制相似问题