How to write php permission control

爱喝马黛茶的安东尼
Release: 2023-02-25 08:18:01
Original
2864 people have browsed it

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!

Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template