PHP learning class:
1. similar objects are classified into a class by means of classification.
2. the class defines the same attributes and methods of these similar objects.
3. the class object is called an instance of the class.
4. class attributes and methods are collectively called class members.
Implement through a class
1. how to define a class
2. how to instantiate class objects
3. how to call class methods
A ."
"; // Obtain the class method echo $ ceshi-> ceshifunction ()."
";?>
4. constructor
5. destructor
A = $ info} // destructor. when the execution ends, when the variable is null, run the // destructor, which is usually used to clean up the resource function _ destruct () {echo "program execution ends ". $ this-> a;} // define the method. function ceshifunction () {echo "this is a test method ";}} // class instantiation $ ceshi = new ceshi ('Another variable '); // Obtain the attribute value echo $ ceshi->."
"; // You can trigger the destructor $ ceshi = null by setting the variable to null; // Obtain the class method echo $ ceshi-> ceshifunction ()."
";?>