本文介绍了PHP朋友/软件包可见性的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否有任何方法可以像在Java中包"可见性或在C ++中至少是朋友"可见性一样,来限制PHP中的可见性?维护大型OOP项目并且不让任何人使用任何代码部分的最佳实践是什么?

Is there any way to limit the visibility in PHP in the same way as "package" visibility works in Java or at least "friend" visibility in C++? What's the best practice to maintain large OOP project and not to let anyone use any part of code?

我尽我所能使用私有和受保护的可见性,但有时还不够.我知道此请求: https://bugs.php.net/bug.php?id = 55331 .在PHP中实现这种东西有什么进展吗?是否有任何变通办法来保护您的代码(方法,类变量)以防止从任何地方访问?

I use private and protected visibility as much as I can but sometimes it's not enough. I know about this request: https://bugs.php.net/bug.php?id=55331. Is there any progress in implementing such thing to PHP? Is there any workaround to protect your code (methods, class variables) from being accessed from anywhere?

推荐答案

此处:

这篇关于PHP朋友/软件包可见性的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-21 18:53