PHP Hata: Fatal error: $ bu zaman kullanma değil nesne bağlamında

0 Cevap php

    public static function assign($name, $value)
    {
        $this->params[] = array($name => $value);
    }

    public static function draw()
    {
        return $this->params;
    }
}


<?php
    $test = Templater::assign('key', 'value')->draw();
    print_r($test);

I need to function "assign" was static, but $params was common for the whole class.. But this code is not working.

Fatal error: Using $this when not in object context

Herhangi bir fikir?

0 Cevap