继续浏览精彩内容
慕课网APP
程序员的梦工厂
打开
继续
感谢您的支持,我会继续努力的
赞赏金额会直接到老师账户
将二维码发送给自己后长按识别
微信支付
支付宝支付

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

williamcarry3384939
关注TA
已关注
手记 1
粉丝 5
获赞 6

看看这技术行不,希望找到能一起交流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
    */
打开App,阅读手记
2人推荐
发表评论
随时随地看视频慕课网APP