One, type constraints:
A) parameter types that the constraint function can pass in
II. traversal of a class
A) Foreach
b) All member properties in the class can be traversed
Iii. Some functions for manipulating classes and objects:
A) Judgment function
I.function_exists () determine if a function exists
Ii. Class_exists () to determine whether a class exists
b) Magic constants:
i.__file__ get the absolute path to the current file
Ii.__line__ gets the line number where the current code is located
Iii.__functions__ gets the name of the current function
Iv.__method__ gets the name of the current method
V.__class__ get the name of the current file
c) A function that determines the properties and methods:
I.property_exists () detects whether a property in a class is set
Ii. Method_exists () detects whether a method in a class is set
Iii. Get_object_vars () Gets the list of properties in the object
iv. Get_class_vars () Gets the list of properties in the class
V.get_class_methods () Gets the list of methods in the class
Vi. Get_class (); Gets the class name instantiated by the object
Iv. Exception Handling:
A) try{
Detects an event that throws an exception if there is an exception (instantiates a system base class exception class and throws it to the variable behind the catch for storage!). This variable can contain all the accumulated methods! )
}catch (Exception $e) {
The error message corresponding to the exception in the try code!
$e->getmessage (); Get error message
$e->getcode (); Get error encoding
$e->getfile (); Get the absolute path to the error file
$e->getline (); Get the line number where the error line is located
}
1 //Exception Handling2 $b= 0;3 Try{4 if($b==0){5 Throw New Exception(' Sorry, the divisor cannot be 0 ', 101);//base class6 }7 $c= 100/$b;8 Echo $c;9}Catch(Exception $e){Ten One //The error in the try code is output here A Echo $e->getmessage (). ' <br/> ';//get the error message! - Echo $e->getcode (). ' <br/> ';//Get error code - Echo $e->getfile (). ' <br/> ';//gets the absolute path of the current error file the Echo $e->getline (). ' <br/> ';//gets the line number of the current error line - -}
"PHP" Object-oriented (v)