php路由器管理源码,route.class.php 最简单轻量的url路由,支持正反向url解析

最简单轻量的php url路由,支持正反向解析,如果亲正在组建自己的框架或者工具库可以考虑嚄。仓鼠出品,必优.

[code]

require_once __DIR__ . '/route.class.php';

function index_init()

{

error_reporting(E_ALL | E_STRICT);

header("Content-Type: text/html;charset=utf-8");

$arr = array(

'/index.html',

'/student/index.html',

'/student/user/index.html',

'/student/user/role/index///.html',

'/index.xml',

'/student/index.xml',

'/student/user/index.xml',

'/student/user/role/index///.xml',

'/index.jsonp',

'/student/index.jsonp',

'/student/user/index.jsonp',

'/student/user/role/index.jsonp',

'/index.json',

'/student/index.json',

'/student/user/index.json',

'/student/user/role/index.jsonp',

);

foreach( $arr as $t )

{

Route::parse_url($t);

prety_printr($_GET);

$route_key = $_GET['q:route'];

unset($_GET['q:route']);

prety_printr( Route::rewrite_url($route_key, $_GET));

}

echo __FILE__;

EXIT;

}

function prety_printr($vars, $label = '', $return = false)

{

$content = "

\n";

if ($label != '') {

$content .= "{$label} :\n";

}

$content .= htmlspecialchars(print_r($vars, true),ENT_COMPAT | ENT_IGNORE);

$content .= "\n

\n";

if ($return) { return $content; }

echo $content;

}

index_init();

[/code]

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值