代码展示:
index.php(加了p这个分发参数)
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 define("PLATFORM",isset($_GET['p'])?$_GET['p']:'test'); 13 require './application/'.PLATFORM.'/controller/'.CONTROLLER.'.controller.class.php';
14 $controlelr_name=CONTROLLER;
15 $controller=new $controlelr_name();
16 $action_name=ACTION;
17 $controller->$action_name();
结果展示: