PHP MVC控制器是否通过url重写实现? [英] Are PHP MVC Controllers implemented by url rewrite?
问题描述
Java EE
应用程序中的控制器可以由
servlet表示,它可以是当前使用JavaServer Faces实现的
)。
但是在PHP中没有这样的servlet,所以我想是通过url重写实现的。
$ b这可以通过mod_rewrite来完成但大多在php有一个前控制器机制,它通过一个单一的文件来控制。这样,所有控制器都在URL中指定。 有关控制器和mvc的详细说明,请参阅php。
The controller in a Java EE application may be represented by a servlet, which may be currently implemented using JavaServer Faces (JSF).
But in PHP there is no such servlet,so I guess is it implemented by url rewrite?
So that every request is directed to that controller?
It can be done with mod_rewrite but mostly in php there is a front-controller mechanisim which does all controlling through a single file. In this way, all controllers are specified in the url. See this for more explanation about controllers and mvc in php.
这篇关于PHP MVC控制器是否通过url重写实现?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!