PHP 会话状态未保存
我正在开发一个网络聊天应用程序。我最近遇到了一个问题,即未保存特定的会话变量。我不知道为什么会发生这种情况,因为其他一切似乎都工作正常。代码:
这是调用与命令关联的函数的类。它的调用方式如下: Command::process("whois", "username_goes_here");
可能出现的问题是什么以及如何解决?
I am working on a Web chat application. I recently ran into a problem where a particular session variable is not being saved. I have no clue why this is happening as everything else appears to work fine. Code:
This is the class that invokes the function the command is associated with. It is called like this: Command::process("whois", "username_goes_here");
What could be the possible problem and how do I fix it?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
如果您需要在会话中保存对象,请注意,需要在保存的对象从会话中恢复生命之前加载对象的类。
在这种情况下,首先加载对象的类定义,然后从会话中读取对象。
PS: 希望
$command
的值不会直接从 HTTP 请求传递到函数中...In case you need to save Objects in a session, please note, that the object's class needs to be loaded before the saved Objects get back to life from the session.
In this case, load the object's class definition first, then read the object from a session.
PS: Hopefully, the value of
$command
doesn't get passed directly from the HTTP request into the function...