我只是试图获得该功能,something但我只是不断收到错误
未捕获错误:类名必须是有效对象或字符串
任何的想法?
class A {
private $a;
private $b;
function __construct($a,$b){
$this->a = ( $a == NULL) ? ' something' : $a;
$this->b = ( $b == NULL) ? ' something' : $b;
echo($this->a);
}
private function geta(){
return $this->a;
}
private function getb(){
return $this->b;
}
public static function something(){
echo $this->a;
echo $this->b;
}
}
$o = new A('hi','something');
$o->A::something();
Run Code Online (Sandbox Code Playgroud)