Php Symfony2子域路由-不同的捆绑包
编辑 现在可以在symfony 2.2中执行此操作Php Symfony2子域路由-不同的捆绑包,php,symfony,Php,Symfony,编辑 现在可以在symfony 2.2中执行此操作 PlatformFooBundle: resource: "@PlatformFooBundle/Resources/config/routing.php" domain: foo.testdomain.com PlatformBarBundle: resource: "@PlatformBarBundle/Resources/config/routing.php" domain: bar.testdomain
PlatformFooBundle:
resource: "@PlatformFooBundle/Resources/config/routing.php"
domain: foo.testdomain.com
PlatformBarBundle:
resource: "@PlatformBarBundle/Resources/config/routing.php"
domain: bar.testdomain.com
PlatformBazBundle:
resource: "@PlatformBazBundle/Resources/config/routing.php"
domain: baz.testdomain.com
您也可以在域中使用参数
在上面编辑
在将此标记为副本之前,请继续阅读
我读过这篇文章,但它无助于我做我想做的事情
我有3个不同的应用程序运行在同一个域名上,有不同的子域。目前,他们都在自己的symfony安装中运行,我想把它去掉
foo.testdomain.com
bar.testdomain.com
baz.testdomain.com
每一个都使用不同的包
PlatformFooBundle
PlatformBarBundle
PlatformBazBundle
它们都有自己的路线定义
基本上,我想要的是这个
PlatformFooBundle:
resource: "@PlatformFooBundle/Resources/config/routing.php"
subdomain: www|devwww
PlatformBarBundle:
resource: "@PlatformBarBundle/Resources/config/routing.php"
subdomain: bar|devbar
PlatformBazBundle:
resource: "@PlatformBazBundle/Resources/config/routing.php"
subdomain: baz|devbaz
我该怎么做呢?正在添加此功能。看看,这对我来说非常有效。我还没有添加包范围的域路由(仅针对使用注释的每个控制器),但我希望它也能工作
例如:
/**
* @Route("/", name="frontend_show", options = {"domain_pattern"="{username}.%base_domain%"})
* @Route("/u/{username}", name="private_show")
* @Template("SiteBundle:Frontend:show.html.twig")
*/
我正在运行类似的设置。你是否在应用程序之间共享供应商目录?是的,我们有自己的内部库,我们在其中放置外部库,如Symfony的core。我修改了bin/vendor文件,并更新了每个应用程序。这将非常棒。希望它能进入2.1