路由

?路由类型

???路由类型有3种,分别是geturicli方式。

1.get类型

//GET参数类型,url=/index.php?r=index/index
$Router?=?new?mpf\route\Router($appRoot?.?'/application/home','get');
$Route?=?$Router->getRoute();
$Route->run();


//GET参数类型,用GET的route参数,url=/index.php?route=index/index
$Router?=?new?mpf\route\Router($appRoot?.?'/application/home','get','route');
$Route?=?$Router->getRoute();
$Route->run();


2.uri类型

//uri类型,url=/index.php/index/index
$Router?=?new?mpf\route\Router($appRoot?.?'/application/home','uri');
$Route?=?$Router->getRoute();
$Route->run();


3.cli类型

//cli类型,命令行模式;php?index.php?index?index
$Router?=?new?mpf\route\Router($appRoot?.?'/application/home','cli');
$Route?=?$Router->getRoute();
$Route->run();
设置404页面


4.设置404页面

$Router?=?new?mpf\route\Router($appRoot?.?'/application/home','uri');
$Router->setPage404(__DIR__.?'/404.html');



php文档