代码
截图:

index.php
<?php
namespace ns;
// 加载配置
require __DIR__.'/config.php';
// 加载核心项
require __DIR__.'/core/Controller.php';
require __DIR__.'/core/Model.php';
require __DIR__.'/core/View.php';
// 加载自定义模型
require __DIR__.'/model/StaffModel.php';
$c = $_GET['c']??APP['default_controller'];
$a = $_GET['a']??APP['default_action'];
$class = ucfirst($c).'Controller';
require __DIR__.'/controller/'.$class.'.php';
// 实例化
extract(DATABASE);
$dsn = sprintf('%s:dbname=%s',$type,$dbname);
$model = new StaffModel($dsn,$username,$password);
$view = new View();
$full = __NAMESPACE__.'\\'.$class;
$controller = new $full($model,$view);
echo $controller->$a();
实例化

