Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我真的不知道我在这里做错了什么。第一页的会话变量在第二页不可用。
注意:第 1 页和第 2 页不在同一个文件夹中。
第 1 页。
<?php session_start(); $_SESSION['TestSession'] = 'Available'; ?>
第2页。
<?php session_start(); echo "Your session variable is ".$_SESSION['TestSession']; ?>
可能这是一个 UTF-8 BOM(字节顺序标记)问题。如果可以访问 windows 环境,您可以使用 Notepad++ 删除 BOM:
在记事本++中打开文件在编码菜单中选择“在没有BOM的UTF-8中编码”然后保存
页面不在同一个文件夹中,但它们在同一个域或子域中???