首先看下文件结构:
┌─[SpringHack@Dosk]─[~/Public/Web/alxw_judge_system]
└──╼ $tree
.
├── Router
│ └── Index.php
├── Runtime
│ ├── App.php
│ ├── Config.php
│ ├── MySQL.php
│ ├── Router.php
│ └── mysql_mysqli.php
├── View
│ └── 404
│ └── index.html
└── index.php
4 directories, 8 files
简单明了,是吧。如果非要说基于什么架构,MVP吧,这里的Router就是P,View就是V,M指的是数据库。Runtime下是各种必要的库文件,如果将来要安装什么第三方的库,我觉得我会再增加一个Vendor目录(是不是想起了ThinkPHP,不过我没抄袭)。
再看看Router下怎么写的,这里只有一个Demo,Index.php:
┌─[SpringHack@Dosk]─[~/Public/Web/alxw_judge_system]
└──╼ $cat Router/Index.php
<?php /**
Author: SpringHack - springhack@live.cn
Last modified: 2016-08-04 22:03:17
Filename: Index.php
Description: Created by SpringHack using vim automatically.
**/ ?>
<?php
Router::uses('/\/$/', function ($param, $url) {
$o = Router::O('404');
Router::Render($o);
});
?>