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 合并列值和拆分列值
合并列值 表结构,数据如下: id value ----- ------ aa bb aaa bbb ccc 需要得到结果: id values ------ ----------- aa,bb aa ...
- wpf CollectionViewSource与ListBox的折叠、分组显示,及输入关键字 Filter的筛选
在wpf中虽然ObservableCollection<T>作为ListBox的Itemsource,很好,很强大!但是CollectionViewSource与ListBox才是天作之合 ...
- 转 Oracle 12c 使用scott等普通用户的方法
一.前言 最近电脑上安装了oracle 12c数据库,想体验下新特性.安装完后,便像11g一样在dos窗口进行下面的操作: SQL*Plus: Release 12.1.0.2.0 Productio ...
- NoSql的产生
主流的关系型数据库:Microsoft SQLServer, IBM DB2, Oracle, MySQL, Microsoft Access, Sybase,IBM Informix 随着互联网we ...
- Android OpenGL ES(二)OpenGL ES管道(Pipeline) .
大部分图形系统都可以比作工厂中的装配线(Assemble line)或者称为管道(Pipeline).前一道的输出作为下道工序的输入.主CPU发出一个绘图指令,然后可能由硬件部件完成坐标变换,裁剪,添 ...
- CentOS下载及版本选择-CentOS LiveCD、LiveDVD和BinDVD区别
1.CentOS系统镜像有两个,安装系统只用到第一个镜像即CentOS-6.x-i386-bin-DVD1.iso(32位)或者CentOS-6.x-x86_64-bin-DVD1.iso(64位), ...
- zend frameword 基本语法
#resources.frontController.moduleDirectory = APPLICATION_PATH "/modules"#resources.frontCo ...
- java 子类继承父类成员变量的隐藏、实现方法的重写
成员变量的隐藏和方法的重写 Goods.java public class Goods { public double weight; public void oldSetWeight(double ...
- play1.x vs play2.x 对比(转)
个人看到对比play1.x和play2.x比较的文章中,写的最深入,最清晰的一个.转自:http://freewind.me/blog/20120728/965.html 为了方便群中的Play初学者 ...
- C# 通过接口 post 请求
/// <summary> /// 提交数据请求 方法一 /// </summary> /// <param name="POSTURL">请求 ...