0

Any reason why I wouldn't be able to access $_SESSION vars I created in "Class A" within a different class, say "Class B"? If I var_dump outside of the Class B, its fine, but within Class B, its report undefined.

Any help would be awesome!

Thanks

4

1 回答 1

1

假设您已经在代码中的某处启动了会话 (session_start()),您应该能够从同一请求中的任何位置访问 $_SESSION 超全局变量。

如果您在单独的请求中加载 B 类,请确保您已启动会话。如果这仍然不起作用,请查看您的 php 配置。

于 2012-07-13T16:16:44.073 回答