简体   繁体   English

在我的名称空间的上下文中使用全局名称空间?

[英]Use global namespace in context on my namespace?

I have 2 controllers 我有2个控制器

 /admin/UserController.php

 /front/UserController.php

I've marked them with namespaces admin and front , but now the problem is that I can't reach the other framework classes, I have to put on every class invoke new \\MyClass , is there a way to access all the global classes, but except the another UserController? 我已经用命名空间adminfront标记了它们,但是现在的问题是我无法访问其他框架类,我必须让每个类都调用new \\MyClass ,是否可以访问所有全局类,但是除了另一个UserController? in other words make a UserController invisible for each other is that possible?, using laravel-4 换句话说,使用laravel-4可以使UserController彼此不可见吗?

I've found it! 我找到了!

use \App\Models
use \BaseController

I've just needed to specify the classes of the framework I will use, then the problem is gone, thanks! 我只需要指定将要使用的框架的类,然后问题就消失了,谢谢!

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

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