简体   繁体   中英

PHP4 session / object problem

I have a weird problem with PHP4

I have a class which assigns a $_SESSION variable.

On the local dev server it works as: $_SESSION['foo'] = $this->foo; and I can access $_SESSION['foo'] as a string.

on the live server $_SESSION['foo'] is not a string but a serialized object? the same code?

好的,我发现$_SESSION['myvar']成为全局$myvar ,并被实例变量$myvar = new MyClass();

I didn't know much about this, but as far i use PHP, PHP 4 have some problem with $_SESSION (and $_SERVER etc) variable(s) and you better stick with the old way creating & storing session (i forgot about it btw). And what make problem was it have bugs in it's Object Oriented model.

Then i stick with PHP 5 works fine, you should consider migrating your application into PHP 5 too :D

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM