getDI

Code:

<?php
    class PMA extends \Phalcon\DI\Injectable {
        public static function uid () {
            var_dump($this -> getDI('session'));
        }
    }
?>

But I didn't get session.



83.2k

In a static function you have to use:

public static function uid ()
{
    var_dump(Phalcon\Di::getDefault()->getSession());
}

http://docs.phalconphp.com/en/latest/reference/di.html#accessing-the-di-in-a-static-way



10.2k
edited Oct '14

In a static function you have to use:

```php public static function uid () { var_dump(Phalcon\Di::getDefault()->getSession()); } ```

http://docs.phalconphp.com/en/latest/reference/di.html#accessing-the-di-in-a-static-way

Elder what time is it now you there?If I didn't guess wrong, should be in the middle of the night?I admire you so professional!



83.2k

It's 23:00 here :D



10.2k

I'd like to make a small suggestion, website can give a CHM version of the manual, the domestic many of us are really want to learn the framework, but mostly because can't read the document and give up, although I try to help them, but my own level is not so good



10.2k

I'd like to make a small suggestion, website can give a CHM version of the manual, the domestic many of us are really want to learn the framework, but mostly because can't read the document and give up, although I try to help them, but my own level is not so good

I see your spirit of dedication, I very admire, I also will continue to support phalcon