, where did the code I wrote go wrong? Why can't Peter be displayed?
离开水的鱼2020-11-23 21:16:17
0
3
1195
Following the teacher step by step, why does the teacher’s final running result peter appear, but I did not report an error, but the browser does not display the word peter.
__construst () The constructor must be double underlined. Most magic methods are like this
Print $obj to see if the data is correct
// 1. Check whether the class exists
var_dump( class_exists('Staff') );// 2. Check whether the attribute exists
var_dump( property_exists('Staff', 'name') );// 3. Get all properties of 1 in the class
var_dump( get_class_vars('Staff') );// 4 . Get all attributes in the object
$a = new Staff;
var_dump( get_object_vars($a) );// 5. Get all methods in the class
var_dump( get_class_methods('Staff') );// 6. Get the class name of the object
var_dump( get_class($a) );