PHP8.1.21版本已发布
vue8.1.21版本已发布
jquery8.1.21版本已发布

,A.php 引入b.php,无法取得b下面aclass的属性

原创
2016-06-13 12:14:58 694浏览

求救,A.php 引入b.php,无法取得b下面aclass的属性

本帖最后由 zhanfu86 于 2015-02-05 12:56:27 编辑 A页面


include("wx.php");
$wx = new wxClass();
$cache= $wx->cache;
?>


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;
}
//连接新浪sae 的memcache,需开通
$mem = memcache_init();
$this->cache= memcache_get($mem,"cache");//获取Token
if(empty($this->cache))
{
$this->cache= "mmmm";
memcache_set($mem,"cache",$this->cache,0,7200);//过期时间为7200秒
}
}
}
?>


其中memcache 是新浪sae的,直接在新浪平台可以查看memcache的cache值,但是通过a页面无法取到。语法没错啊。郁闷
求指教。昨天刚学的php.
------解决思路----------------------
class wxClass
{
var $x= X;
var $y= Y;

下面加一句:public $cache = 1;
再看A页面结果是什么
声明:本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系admin@php.cn核实处理。