Symfony 如何在开发中访问url片段?
在模板中,我通过以下子请求包括组件:Symfony 如何在开发中访问url片段?,symfony,routing,symfony-2.5,Symfony,Routing,Symfony 2.5,在模板中,我通过以下子请求包括组件: {% extends 'HnDocumentBundle:Default:PrintableDocumentLayout.html.twig' %} {% block printable_document_content %} {{ render(controller('HnDocumentBundle:Component/TraineeEducationVoucher:educationVoucherBackToAgencyAgent', { t
{% extends 'HnDocumentBundle:Default:PrintableDocumentLayout.html.twig' %}
{% block printable_document_content %}
{{ render(controller('HnDocumentBundle:Component/TraineeEducationVoucher:educationVoucherBackToAgencyAgent', { trainee: trainee.id })) }}
{% endblock %}
片段没有定义路由名称,我也不希望它们有路由名称,但我仍然希望能够在开发模式下直接访问片段
我是在这样的假设下工作的,即通过使访问站点的本地计算机成为可信代理,片段变得可用。因此,我配置了框架:
framework:
trusted_proxies:
- 192.168.56.1
fragments:
enabled: true
path: /_fragment/
在调试工具栏上,我获得了指向片段的链接,它看起来与预期的一样:
http://localhost.dev/app_dev.php/_fragment/?_path=_format%3Dhtml%26_locale%3Dde%26_controller%3DHnDocumentBundle%253AComponent%252FTraineeEducationVoucher%253AeducationVoucherBackToTrainee
然而,一旦我尝试直接在浏览器中访问,就会出现访问被拒绝的异常。我希望这会发生在生产中,而不是在开发中
我做错了什么?如何使片段URL在开发中可用