~~~ <?php namespace php; class app { static public function run() { $route=new \php\lib\route(); //路由 $controller=$route->controller; $action=$route->action; /* * 文件名规范 /app/controller/indexAction.php * $ccpath=APP.'/controller/'.$controller.'Action.php'; * $obj='\\'.MODEL. '\controller\\' .$controller. 'Action'; */ // 文件名规范 /app/controller/index.php $ccpath=APP.'/controller/'.$controller.'.php'; $obj='\\'.MODEL. '\controller\\' .$controller; if (is_file($ccpath)){ include $ccpath; $aaa= new $obj; $aaa->$action(); }else{ throw new \Exception('找不到控制器'.$ccpath); } } } ~~~