search

Home  >  Q&A  >  body text

How to solve this?

How to solve this? @4DB%VPIE0]22_4KI[WOLNT.png

…………1755 days ago1111

reply all(1)I'll reply

  • ……

    ……2020-03-15 22:14:25

    //创建用户自定义类的加载方法    public function userAutoLoad($className)    {        //定义基本类的列表        $baseClass = [            'Model' => './framework/Model.php',            'Db' => './framework/Db.php',        ];
            //依次进行判断:基础类?模型类?控制器类?        if(isset($baseClass[$className])){            require $baseClass[$className];  //加载模型基类        }elseif(substr($className,-5)=='Model'){            require './application/home/model/'.$className.'.php';  //加载自定义模型基类        }elseif(substr($className,-10)=='Controller'){            require './application/home/controller/'.$className.'.php';  //加载自定义模型类        }    }

    reply
    0
  • Cancelreply