更新时间:2023-09-28 23:28:22
更新:该问题已在根据您的修改,更改此块:
As per your edit, change this block:
<!DOCTYPE html>
<html>
<head>
<?php
define("someUnguessableVariable", "anotherUnguessableVariable");
session_start();
if(!(isset($_SESSION['login']) && $_SESSION['login'] != '')){
header ("Location: login.php");
}
收件人:
<?php
session_start();
?>
<!DOCTYPE html>
<html>
<head>
<?php
define("someUnguessableVariable", "anotherUnguessableVariable");
if(!isset($_SESSION['login']) && $_SESSION['login'] != ''){
header ("Location: login.php");
exit; // stop further executing, very important
}
<?php
等之前没有空格.这已在注释中建立.
<?php
etc. this has already been established in comments.使用诸如Notepad ++之类的代码编辑器 https://notepad-plus-plus.org/并将其保存为不带BOM的UTF-8,这将确保没有字节顺序标记.
Using a code editor such as Notepad++ https://notepad-plus-plus.org/ and to save it as UTF-8 without BOM which will ensure there is no byte order mark.
此外,使用新方法进行会话数组检查.
Also, using the new method for your sessions array check.
if(!isset($_SESSION['login']) && $_SESSION['login'] != ''){
还要检查以确保没有任何包含/必需的文件具有相同的问题,包括login.php
.
Also check to see that none of your included/required files have the same issues, including login.php
.
脚注:
在Notepad ++的下拉菜单中,您将看到
Inside Notepad++'s dropdown menu, you will see
如果确实显示了字节顺序标记,请按照下列步骤操作:
If it does show a byte order mark, follow these steps:
保存文件.
Save the file.
参考文献:
Reference(s):
旁注:
您应将$stmt->execute();
更改为
if(!$stmt->execute()){
trigger_error("there was an error....".$conn->error, E_USER_WARNING);
}