为了账号安全,请及时绑定邮箱和手机立即绑定

symfony官方所有文档代码都补全了

标签:
PHP MySQL

看看这技术行不,希望找到能一起交流smyfony的人,symfony的难度亚于java框架,非得让我写200字,只有贴出一段代码了
上海php装逼大牛群 128026186
<?php
namespace AppBundle\DependencyInjection;
use Symfony\Component\HttpKernel\DependencyInjection\Extension;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\Loader\YamlFileLoader;
use Symfony\Component\Config\FileLocator;
class AppExtension extends Extension {
public function load(array $configs, ContainerBuilder $container) {
$configuration = new Configuration();
$config = $this->processConfiguration($configuration, $configs);
//print_r($config);die;
$container->setParameter('myowoconfig.FOO', $config['foo']);
$loader = new YamlFileLoader(
$container, new FileLocator(DIR . '/../Resources/config')
);
$loader->load('services.yml');
}
public function getAlias() {
return 'myowoconfig'; //bundel名字去掉bundle
}
}
/*

  • Impossible to call set() on a frozen ParameterBag.
    You can't modify Container once it has been compiled, which is done before invoking the controller.
    The DIC parameters are intended for configuration purposes - not a replacement for global variables.
    In addition it seems you want to persist some kind of permanent modification. In that case consider
    using session if it's a per-user modification or persisting it (e.g. into DB) if it's supposed to be application-wide.
    If you need to modify DIC parameters or services, you can do so using a compiler pass.
    More info on how to write custom compiler passes can be found at
    http://symfony.com/doc/master/cookbook/service_container/compiler_passes.html
    */
点击查看更多内容
2人点赞

若觉得本文不错,就分享一下吧!

评论

作者其他优质文章

正在加载中
感谢您的支持,我会继续努力的~
扫码打赏,你说多少就多少
赞赏金额会直接到老师账户
支付方式
打开微信扫一扫,即可进行扫码打赏哦
今天注册有机会得

100积分直接送

付费专栏免费学

大额优惠券免费领

立即参与 放弃机会
意见反馈 帮助中心 APP下载
官方微信

举报

0/150
提交
取消