php 推荐简单的PHP路由引擎

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/9226843/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-26 06:23:38  来源:igfitidea点击:

Recommend simple PHP Routing Engine

phpurlmod-rewriteroutesfat-free-framework

提问by Ticksy

Looking for simple php class routing, like this: http://fatfree.sourceforge.net/page/routing-engine

寻找简单的php类路由,像这样:http: //fatfree.sourceforge.net/page/routing-engine

Is there a ready-made solutions? Or is it better to use the whole framework (it is lightweight, might even cut out the router)?

有现成的解决方案吗?还是使用整个框架更好(它是轻量级的,甚至可以去掉路由器)?

采纳答案by Jér?me R

You might find Silexinteresting. Otherwize if you only care about routing, using mod_rewrite is the most efficient solution.

您可能会发现Silex很有趣。否则,如果您只关心路由,使用 mod_rewrite 是最有效的解决方案。

回答by Selvin Ortiz

You probably already found a solution but one of the routing classes I've been using lately are these two and they've proven to be effective.

您可能已经找到了解决方案,但我最近使用的路由类之一是这两个,并且它们已被证明是有效的。

PHPRouter.php https://github.com/dannyvankooten/PHP-Router
AltoRouter.php https://github.com/dannyvankooten/AltoRouter

PHPRouter.php https://github.com/dannyvankooten/PHP-Router
AltoRouter.php https://github.com/dannyvankooten/AltoRouter

回答by RobinUS2

You might consider stripping down Zend Framework and only use the relevant parts, like:

您可能会考虑剥离 Zend Framework 并仅使用相关部分,例如:

  • Application
  • Router
  • Front controller
  • 应用
  • 路由器
  • 前置控制器

However you will have to make it loose weight yourself, it works pretty nice!

但是,您必须自己减轻重量,它的效果非常好!