, where did the code I wrote go wrong? Why can't Peter be displayed?
离开水的鱼
离开水的鱼 2020-11-23 21:16:17
0
3
1195

image.pngimage.pngFollowing 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. image.png

离开水的鱼
离开水的鱼

reply all(2)
123

__construst () The constructor must be double underlined. Most magic methods are like this

  • reply double underline
    行走 author 2020-11-24 12:27:24
小幸运?

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) );

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!