我从php symfony网站下载的演示应用程序,具有以下控制器语法:
stamper.setEncryption(null,null, PdfWriter.HideWindowUI, PdfWriter.STRENGTH40BITS);
stamper.setViewerPreferences(PdfWriter.HideToolbar);
和
_controller: Symfony\Bundle\FrameworkBundle\Controller\Template::hello
文件的相对路径是app \ config \ routing.yml。
该文件中提到的参考页面没有双冒号\范围解析运算符语法。这是一个有效的语法吗?
http://symfony.com/doc/current/book/routing.html http://symfony.com/doc/current/cookbook/templating/render_without_controller.html
提前致谢。
答案 0 :(得分:0)
简短回答:是的,它是有效的语法。
在PHP中,double colon是
令牌,允许访问静态,常量和重写 类的属性或方法
这就是你的routing.yml中有一个双冒号的原因。它引用了类templateAction
中的hello
或Symfony\Bundle\FrameworkBundle\Controller\Template
方法。
在Symfony中,双冒号主要用于指代Twig模板。我在当前的文档中找不到任何关于它的解释,但我可以在2.2 documentation中找到它:
父模板:: base.html.twig缺少BundleName 和ControllerName的名称部分(因此是双冒号(::) 在开始)。这意味着模板生活在 捆绑包和app目录: