Home >Backend Development >PHP Tutorial >魔术方法_set()和_get()是不是一定要声明为public?解决方案

魔术方法_set()和_get()是不是一定要声明为public?解决方案

WBOY
WBOYOriginal
2016-06-13 10:22:22920browse

魔术方法__set()和__get()是不是一定要声明为public?
魔术方法__set()和__get()是不是一定要声明为public?我的声明为private时,在类外面调用,浏览器提示为“要将__set()和__get()设为public”,可是很多资料书上都可以声明为private啊?

------解决方案--------------------
是的,一定要声明为public,只用这要,才能在外部访问

很多资料书上都可以声明为private啊
请永远的删除这些资料,因为他是在骗你!
------解决方案--------------------

探讨

是的,一定要声明为public,只用这要,才能在外部访问

很多资料书上都可以声明为private啊
请永远的删除这些资料,因为他是在骗你!
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn