serialize/unzerialize help
| From: | andrie | Date: | Fri, 16 Mar 2001 23:45:51 +0000 |
| Subject: | serialize/unzerialize help | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-44341@lists.php.net to get a copy of this message | ||
Hello all members,
i am confuse to pass my class object over page (read my
quote below).
can u give a little example to demonstrate this using serialize
and unserialize function.
thaks for your attention..
andrie
Tuesday, March 13, 2001, 9:03:08 PM, Loe nulis gini:
PK> do you have register_globals enabled in your php.ini? you also have to have
PK> the class definition available when unserializing it to properly reconstruct
PK> the class with all the methods. if you're using PHP4 it's quite handy to use
PK> the built-in session functionality to implement persistent classes.
PK> Pavel
PK> ----- Original Message -----
PK> From: "andrie" <andrie@ajk.its-sby.edu>
PK> To: <php-db@lists.php.net>
>> Hello php-db,
>>
>> if i have a class
>> class myDog {
>> VAR $name;
>> Function bark();
>> }
>>
>> $dog = new myDog;
>>
>> and i want to pass this class over page. someone in this forum said
>> to me to use serialize and pass it using cookies.
>> setcookie("dog", serialize($dog));
>> the question is, when i used unserialize to get this class from
>> other page ,
>> unserialize($dog);
>>
>> i have found out that i can find my class structure or any
>> properties and it values there.
>> anybody can help me ?
>>
>> --
>> Best regards,
>> andrie
>> mailto:andrie@ajk.its-sby.edu