大家好,我花了很多时间来解决这个问题,但我没有找到任何可以帮助我的东西,即使在互联网和堆栈溢出上。我找到了很多关于这个问题的答案,但唯一的问题是我在服务器上而不是在本地PC上遇到此问题。
当有人打开我的页面时,它会正确打开,但在打开 4 到 5 次后它会显示错误。
Forbidden . You don't have permission to access /mypage.php on this server.
代码页 1
<form>
<input type="text" id="field1" >
<input type="text" id="field2" >
<input type="text" id="field3" >
<input type="button" id="subbtn" >
</form>
代码页 2
<?php
require_once( 'parseConnect.php' );
use Parse'ParseClient;
use Parse'ParseObject;
use Parse'ParseQuery;
use Parse'ParseUser;
use Parse'ParseException;
//check if form is submitted
ob_start();
if(isset($_SESSION["loginusername"]))
{
if(isset($_POST["submitform"])){
$fieldvalue = $_POST['feildvalue'];
$query = new ParseObject("table");
$query->set("filed1332432",$filedvalue);
$query->set("field8789",$fieldvalue);
try {
$query->save();
header("location:somepage2121.php#Successfull");
} catch (ParseException $ex) {
header("location:somepage23.php#Some Error Try Again Later.".$ex->getMessage());
}
}
}
else {
ob_clean();
header("location:logout.php");
}
?>
我认为与代码无关,我无法发布实际代码,但这里有一些示例代码页 1 有一个基本的 html 表单,第 2 页具有将其保存在数据库中的功能.. 当我们发布值时,错误发生在第 2 页上 并记住它并不总是。
我建议您检查您的 apache 错误日志,以找出问题的确切根本原因。可能是服务器上安装的mod_security存在问题。