わずか 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 class="brush:php;toolbar:false">\n"; if ($label != '') { $content .= "<strong>{$label} :</strong>\n"; } $content .= htmlspecialchars(print_r($vars, true)); $content .= "\n\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); } ?>