目录关系:
改动代码展示:
index.php
1 <?php 2 /** 3 * Created by PhpStorm. 4 * User: Interact 5 * Date: 2017/8/19 6 * Time: 22:02 7 */ 8 //确定分发参数 9 //动作 10 define('CONTROLLER',isset($_GET['a'])?$_GET['a']:'zixun'); 11 define('ACTION',isset($_GET['c'])?$_GET['c']:'show'); 12 13 require CONTROLLER.'.controller.class.php'; 14 $controlelr_name=CONTROLLER; 15 $controller=new $controlelr_name(); 16 $action_name=ACTION; 17 $controller->$action_name();