"Hanshunping 2016 latest PHP object-oriented Programming video tutorial" explains an important programming idea, is the object-oriented thinking. Learning this kind of thinking will be of great help to future programming.
PHP Object-Oriented Programming video course Introduction
Object-oriented programming has become the mainstream of PHP programming, object-oriented programming to make programs more powerful and flexible, more conducive to project development and maintenance. This chapter is the key to PHP core programming, requires students to understand the object-oriented nature, will use the OOP program design ideas to write programs and projects.
Video Course content: Basic concepts, attributes, class constants, auto-load classes, constructors and destructors, access control (visibility), object inheritance, scope-resolution operators (::), static (static) keywords, abstract classes, object interfaces, Traits, overloads, traversal objects, magic methods, Final Keywords, object replication, object comparisons, type constraints, objects and references, and object serialization
Course Play Address: http://www.php.cn/course/452.html
The teacher's lecture style:
The teacher lively image, witty witty, witty, touching. A vivid image of the metaphor, like the finishing touch, to the students to open the door of wisdom, a proper sense of humor, attracting students to smile, such as drinking a cup of glycol wine, to the aftertaste and nostalgia, the philosopher's motto, culture of the proverbs from time and again interspersed in the middle, give people to think and alert.
The most difficult part of this video is the object-oriented magic method:
__autoload ($classname); This magic method is different from other magic methods, it is not used in the class, the other is used inside the class, as long as in the page with a class, it will automatically pass the class name to the parameters of the function. It is used in development to automatically load classes.
__sleep (): Is the method that is called automatically when object serialization is also called serialization, because when the object is serialized serialize ($object), if the class does not add this magic method, all the properties in the class are automatically serialized, if only to let certain properties be serialized, This method is used to return an array of properties of the class. Sequence which property will put that property in the array. Function: Serializes the object part.
function __sleep () {return array (' name ', ' Age ');} Serializes a name and age two attributes, serializes which property returns an array containing the property in the __sleep method.
$str = Serialize ($object)//Serializes the object into a binary string.
$newobject = Unserialize ($STR);//convert the binary string into a new object that has the properties and methods of the original object.
__wakeup (): The method that is called automatically when deserializing, because a new object is created when the object is deserialized, and each time a new object is created, the object is normally initialized (not required, as the case may be). So the trick is to initialize the newly born object.
__clone (): The method that is called automatically when cloning an object, the $this in this method refers to the object that has just been cloned, and the Magic method is also used to initialize the newly cloned object. $that refers to the original object but does not.
__call ($fnName, args): called automatically when an object calls a method that does not exist outside the class, handles some error calls that do not exist, accepts two parameters, the first parameter accesses a method name that does not exist, and the second parameter is an array of arguments for a method that does not exist.
__tostring (): Automatically called when the object reference is directly exported, because the object cannot be used directly in the class to quickly get the quickest way to represent the object string.
Here also recommend the source of resources to download: http://www.php.cn/xiazai/learn/2121
Resources for everyone to share the video courseware and source code