如何在DataExtension中检索原始类的类名(字符串)?
$.getJSON( "https://api.openaq.org/v1/locations?country=GB", function( data ) {
var html = [];
$.each( data, function( index, hees ) {
$.each( hees, function( att, val ) {
html.push( "<li id='" + att + "'>" + val + "</li>" );
});
});
$( "<ul/>", {
"class": "my-new-list",
html: html.join( "" )
}).appendTo( "#locations" );
});
因此,例如,当将此扩展应用于class FooExtension extends DataExtension {
// This returns "FooExtension" (but I need the original-class name, not the extension's)
private $foo1 = self::class;
// This returns nothing
public function Foo2 {
return $this->owner;
}
// This returns "FooExtension", surprisingly
public function Foo3 {
return get_class($this->owner);
}
// This returns nothing either
public function Foo4 {
return $this->owner->class;
}
}
时,我想在扩展类的某处返回或分配 Page (字符串)。
答案 0 :(得分:6)
您可以通过在DataExtension中调用$this->owner->ClassName
来获取所有者的课程。