: This article mainly introduces the object-oriented php learning Notes (1). If you are interested in the PHP Tutorial, refer to it. 1. First, let's talk about what an object is (the object 'others' is used below to explain it)
1) objects are unique and specific objects in the objective world.
2) it can only complete specific functions.
3) objects can be reused.
2. the object contains two parts:
1) an object's composition element is the object's data model, used to describe the purchased data, also known as the object's attributes, or the object's member variables.
For example, a person's height and weight are attributes of the object.
2) object behavior, used to describe what an object can do, also known as an object method (a function we often call ).
Someone's behavior: eating, drinking, and sleeping.
3. What is object-oriented?
Object-oriented programming stores the data structure (data organization mode) through the object structure during programming. (Attributes and methods)
Why is object-oriented?
1) the object description method is more suitable for the real world and is conducive to the understanding of large businesses.
2) when analyzing the world from the perspective of objects in the actual process of the program, the distance between the program design and the real world can be narrowed.
4. object orientation
1) Object-oriented means to store (attributes and methods) the problems to be solved in life in the way of objects)
2) interaction between objects through method calls
For example, the Courier sends the goods to someone through the "delivery" method.
5. Basic object-oriented thinking
Step 1: recognize objects
Any entity can be recognized as an object.
Step 2:
The data stored in the object is recognized as an attribute.
Different business logic focuses on different data, and the attributes stored in objects are different.
Step 3: identify object behavior
Changes to the object's own attribute data
Object and external interaction
6. Basic object-oriented principles
Objects are highly cohesive: objects are only responsible for a specific function (functions can be larger or smaller ). All object-related content is encapsulated inside the object.
Objects are low-coupling externally: some attributes of objects (not all) can be seen in the external world ). For example, the privacy of a person is invisible to the outside.
The external world can see that objects can do something (not all ). For example, some of the things that someone does are invisible to the outside.
'). AddClass ('pre-numbering '). hide (); $ (this ). addClass ('Has-numbering '). parent (). append ($ numbering); for (I = 1; I <= lines; I ++) {$ numbering. append ($ ('
'). Text (I) ;}; $ numbering. fadeIn (1700) ;}) ;}; script
The above introduces the php learning notes object-oriented (1), including the content, hope to be helpful to friends who are interested in PHP tutorials.