引入类,调用方法

include的前提是class

<?php
    class teacher{
        public $name='huahua';
        public function callName(){
            echo $this->name;
        }
    }
<?php
   include './demo.php';
    $teacher=new teacher;
    $teacher->callName();

 

posted on 2017-12-20 16:48  薇薇123456  阅读(147)  评论(0编辑  收藏  举报

导航