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

WBOY
Release: 2016-06-13 12:14:58
Original
924 people have browsed it

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

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

<br /><?php<br />include("wx.php");<br />$wx = new wxClass();<br />$cache= $wx->cache;<br />?><br />
Copy after login


B页面

<br /><?php<br />define("X", "1111");<br />define("Y","2222");<br /><br />class wxClass<br />{<br />    var $x= X;<br />    var $y= Y;<br />	<br />	public function __construct($x= NULL, $y= NULL) <br />	 {<br />		if($x&& $y){<br />            $this->x= $x;<br />            $this->y= $y;<br />        }<br />		//连接新浪sae 的memcache,需开通<br />		$mem = memcache_init();<br />		$this->cache= memcache_get($mem,"cache");//获取Token<br />		if(empty($this->cache))<br />		{<br />			$this->cache= "mmmm";<br />			memcache_set($mem,"cache",$this->cache,0,7200);//过期时间为7200秒<br />		} <br />	 }<br />}<br />?><br />
Copy after login


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

下面加一句:public $cache = 1;
再看A页面结果是什么
Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!