Phalcon 中的 DI 和 $app 错误
DI and $app error in phalcon
我使用微型应用程序 Phalcon,我为我的 class 命名实用程序创建了一个 DI。当我通过 $app->utility 获取共享实用程序时发生错误。
$di->setShared('utility',function(){
return new utility();
});
$app->get("213",function(){});
$app->utility;
错误:
访问 ($app)
中未定义的 属性 实用程序
但是如果我将代码更改为
$di->setShared('utility',function(){
return new utility();
});
$app->utility;
$app->get("213",function(){});
它工作正常。
为什么?
PHP = 5.6.17
Phalcon = 2.7 或 2.8 或 2.9
windows 10 + nginx
谢谢!
$app 是宏的实例。
$app = 宏($di);
post $di 作为宏的参数并且工作正常。
我使用微型应用程序 Phalcon,我为我的 class 命名实用程序创建了一个 DI。当我通过 $app->utility 获取共享实用程序时发生错误。
$di->setShared('utility',function(){
return new utility();
});
$app->get("213",function(){});
$app->utility;
错误: 访问 ($app)
中未定义的 属性 实用程序但是如果我将代码更改为
$di->setShared('utility',function(){
return new utility();
});
$app->utility;
$app->get("213",function(){});
它工作正常。 为什么?
PHP = 5.6.17
Phalcon = 2.7 或 2.8 或 2.9
windows 10 + nginx
谢谢!
$app 是宏的实例。 $app = 宏($di); post $di 作为宏的参数并且工作正常。