0
나는 대부분 당신에게 문제가되지 않습니다.클래스 내에서 : 함수에서 함수 A에 액세스 B
Exception information: Message: Method "test" does not exist and was not trapped in __call()
나는 대부분 당신에게 문제가되지 않습니다.클래스 내에서 : 함수에서 함수 A에 액세스 B
Exception information: Message: Method "test" does not exist and was not trapped in __call()
:
bat::test2();
난 오류가 : 내 컨트롤러에서
class Bat
{
public function test()
{
echo"ici";
exit();
}
public function test2()
{
$this->test();
}
}
: 은 ... 당신을 위해 명백한 경우 죄송합니다
이
내 코드입니다 Bat :: test2는 정적 함수를 참조합니다. 따라서 정적으로 선언해야합니다. 그렇지class Bat
{
public static function test()
{
echo"ici";
exit();
}
// You can call me from outside using 'Bar::test2()'
public static function test2()
{
// Call the static function 'test' in our own class
// $this is not defined as we are not in an instance context, but in a class context
self::test();
}
}
Bat::test2();
, 당신은 Bat
의 인스턴스를 필요로하고 해당 인스턴스에 함수를 호출 :
$myBat = new Bat();
$myBat->test2();
FbHelper은 박쥐로 무엇을해야합니까? –