简体   繁体   English

在Symfony2控制器上使用命名空间

[英]Using namespace on Symfony2 controller

I am pretty new on symfony2 (just reading its own pdf book) and I am curious that is it must to use namespace name as namespace Acme\\HelloBundle\\Controller; 我是symfony2的新手(只是阅读自己的pdf书),我很好奇,必须使用命名空间名称作为namespace Acme\\HelloBundle\\Controller; ?

It is too long name and can I make it shorter with any other name or do I need to follow the directory path convention to name the namespace of the controller? 它的名称太长了,我可以用其他任何名称缩短名称,还是需要遵循目录路径约定来命名控制器的命名空间?

It has to match the directory structure. 它必须匹配目录结构。 You can view the namespace standard here: 您可以在此处查看命名空间标准:

https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-0.md https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-0.md

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM