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= ...
随机推荐
- sql中 replace函数
例用 xxx 替换 abcdefghi 中的字符串 cde. SELECT REPLACE(''abcdefghicde'',''cde'',''xxx'')
- Guava API
1.字符串的处理 字符串的连接&拆分&匹配及常用操作 Joiner&Splitter @Test public void testJoiner() { String[] str ...
- 关于JAVA插入Mysql数据库中文乱码问题解决方案
方案一:在创建client的时候,指定使用的编码方式 具体如下: conn = DriverManager.getConnection("jdbc:mysql://localhost:33 ...
- Mysql-左连接查询条件失效的解决办法
on 后面不能 接and 要接where 这个条件才能判断成功 判断条件先后顺序,先判断主条件where,再判断条件on 如果是左连接on限制的就是右表,如果不为真则那一行的值为null,where限 ...
- AFHTTPSessionManager
// 取消所有请求 [self.manager.tasks makeObjectsPerformSelector:@selector(cancel)]; 使用场景: 比如一个界面有下拉刷新和上拉加载两 ...
- HUD 1541/BIT(数状数组)
题目链接 /* 按从左到右,从下到上的顺序给出星星的坐标,计算出level为[0,n)的星星的个数. 星星的level为该星星左下边(包括自己正下方的星星,但是不包括自己)星星的个数. BIT模板题. ...
- 【转载】newInstance()和new()
newInstance()和new() 在Java开发特别是数据库开发中,经常会用到Class.forName( )这个方法.通过查询Java Documentation我们会发现使用Class.fo ...
- Swift 响应式编程 浅析
这里我讲一下响应式编程(Reactive Programming)是如何将异步编程推到一个全新高度的. 异步编程真的很难 大多数有关响应式编程的演讲和文章都是在展示Reactive框架如何好如何惊人, ...
- 视频录制SurfaceView
package com.bw.videorecorder; import java.io.File;import java.io.IOException; import android.media.M ...
- Android 系统编译
最近研究了下Android 的编译系统,下面结合编译我们自己的产品 mobot 来对整个编译系统进行必要的介绍,方便大家今 后对默认编译的修改. 先列出几个觉得重要的Make 文件: build/bu ...