Here is some basic knowledge of php_oop
1<?PHP
echo "<meta charset= ' utf-8 ' >"//Set Chinese output2 Header("Content-type:text/html;charset=utf-8"); Set Chinese output3 //1. Building Object-oriented classes:4 classcomputer{5 Public $_name;//a field of a class that can be assigned or not assigned at the time of declaration6 Public $_modle= ' I7 ';7 Public function_run () {//methods of the class8 Echo‘Object-oriented learning ';9 }Ten } One //2. Instantiating an object (an object can be instantiated multiple times and instantiated once is equivalent to creating a separate memory area) A $com 1 = new computer (); - $com 2 = new computer (); -3. Output the value of the $_modle in computer (the ' $ ' variable is not used here) the echo $com 1->_modle; - echo $com 2->_modle; - //4. Assigning values to variables of an object -$com 1->_name = ' Lenovo '; +$com 2->_name = ' Dell '; - //5. Method of Execution + $com 1, _run (); A?>
01.php Object Oriented