Home  >  Article  >  Backend Development  >  成员属性在两个步骤之间无法共用

成员属性在两个步骤之间无法共用

WBOY
WBOYOriginal
2016-06-13 12:41:17824browse

成员属性在两个方法之间无法共用

<br />
class a {<br />
    public $a=0;<br />
     public fucntion ax(){<br />
        $this->a='111';<br />
     }<br />
<br />
    public fucntion bx(){<br />
        echo $this->a;<br />
     }<br />
}<br />

$a在ax()中赋值之后,如何才能在bx()中调用值等于111的那个$a?在一个方法中给一个属性赋值之后另一个方法无法获得那个值

PHP
Statement:
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