secce 发表于 2017-4-13 08:23:05

刚刚建的仅2k的可配置的PHP URL 路由 http://code.google.com/p/qserouter/

地址: http://code.google.com/p/qserouter/ 上午刚刚建的 :-)

<?php
require 'router.php';
function dump($vars, $label = '', $return = false)
{
if (ini_get('html_errors')) {
$content = "<pre>\n";
if ($label != '') {
$content .= "<strong>{$label} :</strong>\n";
}
$content .= htmlspecialchars(print_r($vars, true));
$content .= "\n</pre>\n";
} else {
$content = $label . " :\n" . print_r($vars, true);
}
if ($return) { return $content; }
echo $content;
return null;
}
$routes = new Router(require('mapping.php'));
$testarr = array(
'/',
'/abc',
'/abc/d',
'/books/13',
'/books/13/java',
'/admin',
'/admin/',
'/admin/abc',
'/admin/abc/d',
);
foreach ($testarr as $item){
dump($routes->filter($_GET,$item),$item);
}

?>
页: [1]
查看完整版本: 刚刚建的仅2k的可配置的PHP URL 路由 http://code.google.com/p/qserouter/