With PHP frameworks, why is the “route” concept used?
|
The reason I ask this is because isn't a PHP script a route? For example, if you have an article.php then your route is simply http://mysite.com/article.php. Why further abstract away the concept of a route when it already exists as a simple file? |
|||
|
To understand what a router does, you must first understand what a rewrite engine is. From theWikipedia article (emphasis mine):
When a rewrite engine is used you don't have an 1:1 correlation between the URL and a PHP script. An example from the same article:
There are various benefits to using the technique. Since PHP is usually tightly coupled with Apache, the most commonly used rewrite engine is Apache's mod_rewrite. If you want rewritten URLs, you need some kind of routing, as routing is the process of taking the URL, braking it into components and deciding what is the actual script to call. The documentation page for the standard router of the Zend Framework explains the process as:
Most PHP frameworks nowadays are based on the MVC pattern, and on an MVC framework the process goes something like this*:
Matching parameters to controllers and methods usually employs matching via regular expressions to be able to handle complex and dynamic routing patterns, known as routes. Good examples of routes can be found on CodeIgniter's URI Routing documentation page:
The *This is not intended as a description of the canonical process, just an oversimplified explanation. |
|||||||||
|
With PHP frameworks, why is the “route” concept used?的更多相关文章
- [Angular2 Router] Configuring a Home Route and Fallback Route - Learn An Essential Routing Concept
In this tutorial we are going to learn how to configure the Angular 2 router to cover some commonly ...
- The Top 10 Javascript MVC Frameworks Reviewed
Over the last several months I have been in a constant search for the perfect javascript MVC framewo ...
- Notes of Linked Data concept and application - TODO
Motivation [反正债多了不愁,再开个方向.] Data plays a core role in most business systems, data storage and retrie ...
- Top JavaScript Frameworks, Libraries & Tools and When to Use Them
It seems almost every other week there is a new JavaScript library taking the web community by storm ...
- 大数据日志分析产品——SaaS Cloud, e.g. Papertrail, Loggly, Sumo Logic;Open Source Frameworks, e.g. ELK stack, Graylog;Enterprise Products, e.g. TIBCO LogLogic, IBM QRadar, Splunk
Learn how you can maximize big data in the cloud with Apache Hadoop. Download this eBook now. Brough ...
- Awesome Go精选的Go框架,库和软件的精选清单.A curated list of awesome Go frameworks, libraries and software
Awesome Go financial support to Awesome Go A curated list of awesome Go frameworks, libraries a ...
- Application Request Route实现IIS Server Farms集群负载详解
序言 随着公司业务的发展,后台业务就变的越来越多,然而服务器的故障又像月经一样,时不时的汹涌而至,让我们防不胜防.那么后台的高可用,以及服务器的处理能力就要做一个横向扩展的方案,以使后台业务持续的稳定 ...
- .net core 源码解析-mvc route的注册,激活,调用流程(三)
.net core mvc route的注册,激活,调用流程 mvc的入口是route,当前请求的url匹配到合适的route之后,mvc根据route所指定的controller和action激活c ...
- angular路由——ui.route
angular路由 使用案例 <!DOCTYPE html> <html lang="en"> <head> <meta charset= ...
随机推荐
- psy 2
PSY,心理线,顾名思义,庄家要洗筹必须打破市场尤其是散户的心理防线,才能让大家乖乖的交出筹码.月线的心理线尤其重要,PSY有几个数值,16,25,33,41,50,66,75.PSY的运用也是抓大黑 ...
- memcached的安装(server、client)、magent整合
声明:本编文章基于网络上的文章(90%),基本就是把我的安装步骤写一下,遇到问题记录一下 1.背景:项目需要多台服务器负载均衡,我们的应用有付费会员,不能让一个账号随便登陆,一个时间段只能一个账号,这 ...
- CSS box-flex属性
http://www.zhangxinxu.com/wordpress/2010/12/css-box-flex属性,然后弹性盒子模型简介/ http://www.zhangxinxu.com/wor ...
- webwork <ww:if> 标签的使用
如果在前台(JSP)取出后台的对象的属性,这个属性在后台是属于String 类型的,但若这个属性的值为数字,取出在前台就会默认为整形的值,所以在<ww:if> 判断里面不能加引号:< ...
- 在PL/SQL/sqlplus客户端 中如何让程序暂停几秒钟
1. how to check procedure exist: SQL> conn oper/oper123Connected.SQL> desc dbms_lock;PROCEDURE ...
- Springmvc默认首页的问题
之前自己写的springmvc 默认首页都是偷懒方式: web.xml 中定义的默认首页: <welcome-file-list> <welcome-file>index.ht ...
- Anton and Chess
Anton and Chess time limit per test 4 seconds memory limit per test 256 megabytes input standard inp ...
- Hibernate 系列教程9-自关联
自关联:本质还是原来双向一对多,原来要配置两个类,现在全部都配置在一个类里面 Employee public class Employee { private Long id; private Str ...
- IDL 实现求算 DEM 坡度坡向
关于坡度坡向的定义,请Google之. 源码: IDL 源码PRO ASPECT_SLOPE,DEM,ASPECT = ASPECT,SLOPE=SLOPE,PIXELSIZE = PIXELSIZE ...
- 阅读 LdrInitializeThunk
参考: http://blog.csdn.net/hw_henry2008/article/details/6568255 Windows 的 DLL 装入(除 ntdll.dll 外)和连接是通过 ...
