For help, A. php introduces B. php and cannot obtain the attribute of aclass under B. This post was last edited by zhanfu86 from 2015-02-0512: 56: 27 on page A & lt ;? Phpinclude (wx. php); $ wx & nbsp; new & nbsp; wxClass (); $ cache & nbsp; $ wx for help,. php introduces B. php, unable to obtain the aclass attribute under B
This post was last edited by zhanfu86 at 12:56:27 on
Page
include("wx.php");
$wx = new wxClass();
$cache= $wx->cache;
?>
Page B
Define ("x"," 1111 ");
Define ("Y", "2222 ");
Class wxClass
{
Var $ x = X;
Var $ y = Y;
Public function _ construct ($ x = NULL, $ y = NULL)
{
If ($ x & $ y ){
$ This-> x = $ x;
$ This-> y = $ y;
}
// Connect to the memcache of Sina sae and activate it
$ Mem = memcache_init ();
$ This-> cache = memcache_get ($ mem, "cache"); // Get Token
If (empty ($ this-> cache ))
{
$ This-> cache = "mmmm ";
Memcache_set ($ mem, "cache", $ this-> cache, 7200); // The Expiration Time is seconds.
}
}
}
?>
Memcache is from Sina SAEs. you can view the cache value of memcache directly on Sina platform, but it cannot be obtained through page. The syntax is correct. Depressing
Please advise. Php I just learned yesterday.
------ Solution ----------------------
Class wxClass
{
Var $ x = X;
Var $ y = Y;
Add one sentence: public $ cache = 1;
What is the result of page?