如何在一个文件 yii2 中使用两个命名空间? [英] How to use two namespaces in one file yii2?
本文介绍了如何在一个文件 yii2 中使用两个命名空间?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
yii2 如何在一个文件中使用两个命名空间?
我需要使用
命名空间后端/控制器;命名空间 MongoDb;
解决方案
你可以这样实现:
<块引用>
http://php.net/manual/en/language.namespaces.definitionmultiple.php
How can use two namespaces in one file yii2?
I need to use
namespace backend/controllers;
namespace MongoDb;
解决方案
You can achieve it like this:
<?php
namespace backend/controllers;
{ /* Code goes here */ }
{ /* Some more code */ }
namespace MongoDb;
{ /* Code goes here */ }
{ /* Some more code */ }
?>
http://php.net/manual/en/language.namespaces.definitionmultiple.php
这篇关于如何在一个文件 yii2 中使用两个命名空间?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文