本文介绍了PHP类中受保护/私有的重要性的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
通常,当我看到PHP类时,大多数变量和函数都是私有的或受保护的.因为PHP是在服务器端执行的,所以我不明白您为什么需要这些安全功能.这些可用于安全性还是我缺少什么?
Usually when I see PHP classes, most of the variables and functions are either private or protected. Because the PHP is executed on the server side, I don't understand why you would need these security features. Are these available for security or am I missing something?
推荐答案
在可见性,而不是严格意义上的安全性功能.
Private and protected make sense in the context of visibility, and not security features stricto senso.
这篇关于PHP类中受保护/私有的重要性的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!