Object oriented php class simple example

后端 未结 2 1070
忘了有多久
忘了有多久 2021-02-05 20:09

i am beginner on php so now i try to learn object oriented i was goggling i got it some ideas but not clear concept.So i come there.Please any php guru give simple example of ho

2条回答
  •  野趣味
    野趣味 (楼主)
    2021-02-05 20:36

    The way you are calling a php page is good. That is from HTML.

    What I think, you are getting this wrong. A class showName to get name from database and enterName to save in database. Well what I suggest that should be a function within one single class.

    name);
        }
        public function enterName($TName)
        {
            $this->name = $TName;
            /**
            Put your database code here.
            **/
        }
    }
    ?>
    

    In checking.php you can include:

    enterName($name); //to save in database/
        $name=$myName->showName(); //to retrieve from database. 
    ?>
    

    This way you can achieve this, this is just an overview. It is much more than that.

提交回复
热议问题