Ada*_*dam 7 php symfony silex pimple
在Pimple 1.0中,我曾经能够像这样共享类实例:
$app['some_service'] = $app->share(function () {
return new Service();
});
Run Code Online (Sandbox Code Playgroud)
现在这似乎已被弃用,我无法找到这样做的新方法.
Jav*_*luz 13
在Pimple 1.0(Silex 1)中,你这样做:
$app['shared_service'] = $app->share(function () {
return new Service();
});
$app['non_shared_service'] = function () {
return new Service();
};
Run Code Online (Sandbox Code Playgroud)
在Pimple 3.0(Silex 2)中你这样做(这是相反的!):
$app['shared_service'] = function () {
return new Service();
};
$app['non_shared_service'] = $app->factory(function () {
return new Service();
});
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
1438 次 |
| 最近记录: |