我的问题是:如何从routing.yml生成外部URL?
我想要类似的东西:
documentation_product1:
pattern: /my/documentation/product1.php
default: http://www.myothersite.com/product1
Run Code Online (Sandbox Code Playgroud)
它可能或类似的东西?
可以在控制器内重定向到外部站点
documentation_product1:
pattern: /my/documentation/product1.php
defaults: { _controller: AcmeBundle:Product:show }
// in controller
$this->redirect('http://www.myothersite.com/product1');
Run Code Online (Sandbox Code Playgroud)
但这不是一个好习惯.
最好使用FrameworkBundle中的RedirectController.(由Paulpro提及)
数独:
http://symfony.com/doc/current/cookbook/routing/redirect_in_config.html
| 归档时间: |
|
| 查看次数: |
2033 次 |
| 最近记录: |