更新时间:2023-11-14 23:48:58
好吧,您只能在类中使用 $this
.在类之外,$this
不应该存在.它基本上引用了您在其中工作的当前类对象.要使其正常工作,您需要将一个变量定义为一个新类,然后通过该变量引用所有内容,例如:
Well you can only use $this
inside of a class. Outside of a class, $this
shouldn't exist. It basically references the current class object that you're working inside of. To get this working properly, you need to define a variable as a new class and then reference everything through that variable, such as:
$myvar = new MyClass();
$h1 = $myvar->params->get("logo");
如果那是你正在做的事情.
If that's the kind of thing you're doing.