基本概念:

  platform 平台,在view/html中 填写参数p

  用来确定当前的平台,比如

  index.html?p=test&c=Mybank&a=show

  test平台下的Mybank控制器类中的show动作

  index.html?p=home&c=Myuser&a=delete    

  home平台下的Myuser控制器下的delete动作

 

步骤1:

  在test平台下的View中的Mybank.html中添加p参数,要保证p是最先获取的

  

        <td><?=$value['id']?></td>
        <td><?=$value['carNo']?></td>
        <td><?=$value['money']?></td>
        <!-- 填写a参数和c参数的值-->
        <td> <a href="index.php?p=test&c=Mybank&a=delete&id=<?=$value['id']?>">删除</a> </td>
    </tr>
    <?php endforeach?>
    </table>
    <p>
        <!-- 主动携带a和c参数的值 -->
        <a href="index.php?p=test&c=Myuser&a=show">获取my_user表</a>
    </p>
</body>
</html>

步骤2:在index.php入口文件中获取p参数

    //使用常量来保存参数p,平台的名字,
    $default_paltForm="test";
    define('PLATFORM',isset($_GET['p']) ? $_GET['p'] : $default_paltForm);
    //载入当前所需要的控制器
    include "./application/". PLATFORM."/Controller/{$controller_name}.class.php";

 

相关文章:

  • 2021-09-08
  • 2021-04-10
  • 2021-09-22
  • 2021-11-27
  • 2022-01-08
  • 2021-07-07
  • 2021-08-08
猜你喜欢
  • 2021-09-01
  • 2022-12-23
  • 2022-12-23
  • 2021-11-16
  • 2021-08-15
  • 2022-12-23
  • 2021-05-22
相关资源
相似解决方案