简体   繁体   English

如何获取file.php / dir标头

[英]How to get file.php/dir header

I often see websites with URLs like domain.com/index.php/directory . 我经常看到网址如domain.com/index.php/directory网站。 How does it work? 它是如何工作的? It looks like there is a directory in a file. 看起来文件中有一个目录。

I want to do the same on my own website. 我想在自己的网站上做同样的事情。 Sample code is appreciated. 样例代码表示赞赏。

I think it has more to do with filesystems and less with PHP. 我认为它与文件系统有更多关系,而与PHP无关。 A directory can be named index.php or any other thing with a dot. 目录可以命名为index.php或带点的任何其他名称。

You could just create a folder named 'index.php' to achieve the same result, but I think what you are referring to is sites using Model-View-Controller (mvc) framework type. 您可以只创建一个名为“ index.php”的文件夹以实现相同的结果,但是我认为您指的是使用Model-View-Controller(mvc)框架类型的网站。

I am not very familiar with the concept, but basically the file called is index.php and the following "directories" are in fact parameters passed to the script. 我对这个概念不是很熟悉,但是基本上,名为“ index.php”的文件和以下“目录”实际上是传递给脚本的参数。

Maybe this could help: How to do MVC form url formatting? 也许这可以帮助您: 如何进行MVC表单url格式化?

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM