Home  >  Article  >  Backend Development  >  How to write php permission control

How to write php permission control

爱喝马黛茶的安东尼
爱喝马黛茶的安东尼Original
2019-09-27 09:30:092717browse

How to write php permission control

PHP5 provides 3 access methods:

Related recommendations: "php Basic Tutorial"

They are as follows:

(1) public: can be accessed without restrictions. Any code outside the class can read and write public properties. In versions before PHP5, all methods and Properties are all public.

(2) private: only visible inside the class. Any member and class instance in the class can access private members. Outside the class, the value of the private attribute cannot be changed or read, nor can Call private methods. Subclasses cannot access private members of the parent class.

(3) protected: Can be accessed by methods of the same class and inherited classes.

If not specified, the default is public.

The above is the detailed content of How to write php permission control. For more information, please follow other related articles on the PHP Chinese website!

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