i'm trying to unserialize Object. i run the documentaion sample.
code for classa.inc:
PHP Code:
<?php
class A {
var $one = 1;
function show_one() {
echo $this->one;
}
}
?>
code for page1:
PHP Code:
<?php
session_start();
include("classa.inc");
$a = new A;
$s = serialize($a);
setcookie("test",$s);
$nextPage = "page2.php";
header("Location: $nextPage");
?>
code for page2:
PHP Code:
<?php
include("classa.inc");
$s =$_COOKIE["test"];
$a = unserialize($s);
if(is_object($a)){
echo "a is an Object!<br/>" ;
$a->show_one();
}else{
echo "a is not an Object!<br/>";
}
?>
Simple right.
result when run page1
a is not an Object!
i check and cookie test have been creted
i can't find why i cant use the object?
thanks for any help..