0
當我嘗試創建一個路徑變量:創建路徑的PHP文件生成路徑未找到錯誤
{% block jquery %}
<script>var url = "{{ path('bundles/foo/ajax/widb-get-data.php') }}";</script>
{% endblock %}
我收到以下錯誤:
An exception has been thrown during the rendering of a template ("Unable to generate a URL for the named route "FooBundle:Default:myfile.php" as such route does not exist.")
Symfony應該使用路由而不是特定的php文件? – hcoat
感謝您的回覆。對不起,我是Symfony的新手,你能否詳細說明一下? – AnchovyLegend
路由指向生成響應的控制器中的方法。對於可見頁面,這與用於ajax的頁面相同。看起來你需要閱讀[controllers](http://symfony.com/doc/current/book/controller.html)和[routing](http://symfony.com/doc/current/book/ routing.html)。 – hcoat