0
類屬性我有以下代碼:如何訪問方法
class FanClub_Banner
{
public $img = 'http://www.example.com/museum/images/logo_ver_250.png';
public static function banner_me(array $widget, $positionCode, array $params, XenForo_Template_Abstract $renderTemplateObject)
{
return '<img src="'. $this->$img . '" width="250" height="250" alt="Museum">';
}
}
和我得到的錯誤:
Fatal error: Using $this when not in object context in C:\public_html\comunidad\library\FanClub\Banner.php on line 8
如何解決呢?
感謝