I
I
Ivan Ivanov2019-06-30 02:33:39
PHP
Ivan Ivanov, 2019-06-30 02:33:39

And how can this be?

Hello!
once

<?php


namespace app\controllers;


use vendor\core\base\Controller;

class AppController extends Controller
{
    protected static $site = [];

    public function __construct($route)
    {
        parent::__construct($route);
        self::$site['generator'] = 'ВОЙНУШКА';
        self::$site['all_users'] = self::decline(self::pdo('select * from users')->rowCount(), [
            'воин',
            'воина',
            'воинов'
        ]);
        self::$site['page_generation'] = round(microtime(true) - $_SERVER['REQUEST_TIME_FLOAT'], 3) . ' сек, ';
        self::$site['server_time'] = date('H:i:s');
        self::$site['online'] = self::pdo('select * from users where online > ?', [
            time()
        ])->rowCount();
        self::$site['description'] = 'Военная экономическая стратегия';
        $site = self::$site;
        self::set(compact('site'));
    }
}

two
<?php


namespace vendor\core\base;


abstract class Controller extends Model
{
    public $route = [];
    public $vars = [];

    public function __construct($route)
    {
        $this->route = $route;
    }

    public function set($vars)
    {
        $this->vars = $vars;
    }
}

three

5d17f4d311391175710434.png

Well, how did we call the NON-STATIC set method using self (I just typed it by accident) and the data flew away normally?
Thank you.
ps it will start)))

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question