Home > php教程 > PHP开发 > body text

PHP object-oriented access type control

WBOY
Release: 2016-08-04 08:57:03
Original
1266 people have browsed it

The three modifiers public, protected, and private are the access control mechanisms introduced in php5. By using modifiers, developers can restrict access to members in a class. Literally, these three modifiers are translated into Chinese as public, protected, and private. Let's use code examples to see how public, protected, and private restrict members in a class.


Public access modifier public

The public modifier has no access restrictions on members in the class, and all external members can access members in this class.

<?php
class myclass{
public $public
Copy after login
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 Recommendations
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template