php 如果在类中定义变量,在类的方法中调用时应该加上$this-> .
class ClassName
{
private $a = 333;
function __construct()
{
$this->a = 2222;
}
public function bbb($value='')
{
echo $this->a;
}
}
$b = new className();
echo $b->bbb();
php 如果在类中定义变量,在类的方法中调用时应该加上$this-> .
class ClassName
{
private $a = 333;
function __construct()
{
$this->a = 2222;
}
public function bbb($value='')
{
echo $this->a;
}
}
$b = new className();
echo $b->bbb();