我解决了与用户写权有关的一堆问题,现在我得到了一个SYMFONY ERROR页面(距胜利一步一步),并显示以下消息: 无法找到模板"MyBundle:std_page:home.html.twig"(已查找 进入:/[symf项目文件夹]/app/Resources/views,/[symf专案资料夹]/vendor/symfony/symfony/src/Symfony/Bridge/Twig/Resources/views/Form,/[symf专案资料夹]/vendor/knplabs/knp-menu/src/Knp/Menu/Resources/views).如果我查看我的[symf项目] \ app \ config \ routing.yml,就会发现:my_bundle: resource: "@MyBundle/Resources/config/routing.yml" options: expose: true在[我的symf项目] \ app \ AppKernel.php中,在registerBundles()函数中,我具有:class AppKernel extends Kernel{ public function registerBundles() { $bundles = [ .... new MyBundle\MyBundle(), ..... ] }}并且存在有关应提取[my symf project]\src\MyBundle\Ressources\views/std_page/home.html.twig的模板的文件. 在生产模式下,我没有正确设置什么以使其在文件夹[my symf project]\src\MyBundle\Ressources\views/中寻找TWIG模板吗? 解决方案经过一番搜索,它碰巧是一个与 SO线程.在我的控制器中,我有:return $this->render('MyBundle:Std_page:home.html.twig',$parameters);代替:return $this->render('MyBundle:std_page:home.html.twig',$parameters);开发是在WINDOWS 10操作系统上进行的,并且已在UBUNTU 16.04上投入生产. 对于字母大小写,UBUNTU似乎比WINDOWS更严格. I am implementing a SYMFONY 3 project in production mode for the first time.I follow OceanDigital tutorial and the standard doc.I went thru a bunch of issues linked to user writing rights that I've solved, and I do get now a SYMFONY ERROR page (one step closer to victory) with this message: Unable to find template "MyBundle:std_page:home.html.twig" (looked into: /[folder to symf project]/app/Resources/views, /[folder to symf project]/vendor/symfony/symfony/src/Symfony/Bridge/Twig/Resources/views/Form, /[folder to symf project]/vendor/knplabs/knp-menu/src/Knp/Menu/Resources/views).If I look in my [my symf project]\app\config\routing.yml, I have:my_bundle: resource: "@MyBundle/Resources/config/routing.yml" options: expose: trueIn [my symf project]\app\AppKernel.php, in the registerBundles() function, I have:class AppKernel extends Kernel{ public function registerBundles() { $bundles = [ .... new MyBundle\MyBundle(), ..... ] }}And the file regarding the template that should be fetched [my symf project]\src\MyBundle\Ressources\views/std_page/home.html.twig exists.What did I not set up right, in production mode, to have it looking for the TWIG template in the folder [my symf project]\src\MyBundle\Ressources\views/? 解决方案 After some search it happens to be a mistake similar to the one described in that SO thread.In my controller I had:return $this->render('MyBundle:Std_page:home.html.twig',$parameters);Instead of:return $this->render('MyBundle:std_page:home.html.twig',$parameters);The development was made on a WINDOWS 10 OS, and it is set up in production on a UBUNTU 16.04. It seems that UBUNTU is stricter than WINDOWS regarding the letter case. 这篇关于产品中的SYMFONY3在错误的文件夹中查找TWIG模板,而不是routing.yml和AppKernel.php中指示的自定义包的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持! 09-13 02:13