I use micro app Phalcon, I created a DI to my class named utility. When I get the shared utility through $app->utility an error occurred.
$di->setShared('utility',function(){
return new utility();
});
$app->get("213",function(){});
$app->utility;
error: Access to undefined property utility in ($app)
But if I change the code to
$di->setShared('utility',function(){
return new utility();
});
$app->utility;
$app->get("213",function(){});
It works fine. WHY?
PHP = 5.6.17
Phalcon = 2.7 or 2.8 or 2.9
windows 10 + nginx
THANKS!